随笔 - 2146  文章 - 19 评论 - 11846 阅读 - 1267万

随笔分类 -  API 进程与线程函数

遍历进程并获取进程路径 - 回复 "编程少年" 的问题
摘要:代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; Memo1: TM... 阅读全文
posted @ 2008-12-22 22:48 万一 阅读(6070) 评论(21) 推荐(0) 编辑
根据窗口句柄获取所在程序路径 - 回复 "Haiwen" 的问题
摘要:问题来源: http://www.cnblogs.com/del/archive/2008/07/30/1255869.html#1272342 本例效果图: 代码文件: unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dia... 阅读全文
posted @ 2008-07-30 17:35 万一 阅读(8748) 评论(18) 推荐(0) 编辑
WinAPI: GetModuleFileName、GetModuleHandle
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure FormCr... 阅读全文
posted @ 2008-06-17 11:40 万一 阅读(9412) 评论(13) 推荐(0) 编辑
WinAPI: GetModuleHandle - 获取一个模块(exe 或 dll)的句柄
摘要:定义: GetModuleHandle( lpModuleName: PChar {模块名; 只能是映射到当前进程的模块} ): HMODULE; {返回模块句柄; 0 表示失败} 举例: //获取当前模块的句柄 var s: string; h: Cardinal; begin {先取得模块名} s := Application.ExeName;... 阅读全文
posted @ 2008-04-01 13:48 万一 阅读(25163) 评论(4) 推荐(0) 编辑
WinAPI: OpenProcess、GetExitCodeProcess、TerminateProcess (测试强制关闭 OICQ)
摘要://声明: {返回进程的句柄} OpenProcess( dwDesiredAccess: DWORD; {访问选项} bInheritHandle: BOOL; {能否继承; True 表示能用 CreateProcess 继承句柄创建新进程} dwProcessId: DWORD {指定进程 ID} ): THandle; {成... 阅读全文
posted @ 2008-03-10 12:19 万一 阅读(18413) 评论(17) 推荐(0) 编辑
WinAPI: GetWindowThreadProcessId - 获取指定窗口的进程 ID 或线程 ID
摘要://声明: GetWindowThreadProcessId( hWnd: HWND; {指定窗口句柄} lpdwProcessId: Pointer = nil {返回进程 ID 的指针} ): DWORD; {返回线程 ID} //举例: unit Unit1; interface uses Wi... 阅读全文
posted @ 2008-03-10 11:59 万一 阅读(18097) 评论(1) 推荐(0) 编辑
WinAPI: GetCurrentThread、GetCurrentThreadId、GetCurrentProcess、GetCurrentProcessId
摘要:{返回当前线程的虚拟句柄} GetCurrentThread: THandle; {返回当前线程 ID} GetCurrentThreadId: DWORD; {返回当前进程的虚拟句柄} GetCurrentProcess: THandle; {返回当前进程 ID} GetCurrentProcessId: DWORD; 提示: ID 是系统唯一的标识. 所谓虚拟句柄, 就是该句柄只... 阅读全文
posted @ 2008-03-10 10:43 万一 阅读(19914) 评论(0) 推荐(0) 编辑
WinAPI: LoadLibrary、FreeLibrary - 载入与载卸模块
摘要://声明: LoadLibrary( {将可执行模块映射到调用进程的地址空间} lpLibFileName: PChar {DLL 或 EXE 文件名; 如没指定路径会按以下顺序查找: 程序目录/当前目录/System32/Windows/PATH环境变量} ): HMODULE; {返回模块句柄} FreeLibrary( hLibModul... 阅读全文
posted @ 2008-02-15 23:04 万一 阅读(5472) 评论(0) 推荐(0) 编辑
WinAPI: ShellExecute - 打开外部程序或文件
摘要:ShellExecute( hWnd: HWND; {指定父窗口句柄} Operation: PChar; {指定动作, 譬如: open、print} FileName: PChar; {指定要打开的文件或程序} Parameters: PChar; {给要打开的程序指定参数; 如果打开的是文件这里应该是 nil} Directory: PChar; ... 阅读全文
posted @ 2008-02-13 21:59 万一 阅读(47088) 评论(19) 推荐(3) 编辑
WinAPI: WinExec - 运行外部程序
摘要://声明 WinExec( lpCmdLine: LPCSTR; {文件名和参数; 如没指定路径会按以下顺序查找: 程序目录/当前目录/System32/Windows/PATH环境变量} uCmdShow: UINT {启动选项} ): UINT; //返回值: 大于 31 {调用成功} 等于 0 ... 阅读全文
posted @ 2008-02-13 14:14 万一 阅读(20806) 评论(12) 推荐(1) 编辑



点击右上角即可分享
微信分享提示