通过进程ID获取进程名
来源:互联网 发布:js中unicode编码 编辑:程序博客网 时间:2024/04/29 06:07
通过进程ID获取进程名
网上流传代码:
uses TLhelp32function GetProcessNameById(const AID: Integer): String;var h:thandle; f:boolean; lppe:tprocessentry32;begin Result := ''; h := CreateToolhelp32Snapshot(TH32cs_SnapProcess, 0); lppe.dwSize := sizeof(lppe); f := Process32First(h, lppe); while integer(f) <> 0 do begin if Integer(lppe.th32ProcessID) = AID then begin Result:= StrPas(lppe.szExeFile); break; end; f := Process32Next(h, lppe); end;end.
自我改编代码
uses TLhelp32,PsAPI;function GetProcessName(ProcessID: DWORD): string;var Hand: THandle; ModName: array[0..Max_Path - 1] of Char; hMod: HModule; n: DWORD;begin Result := ''; Hand := OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False, ProcessID); if Hand > 0 then try try ENumProcessModules(Hand, @hMod, Sizeof(hMod), n); if GetModuleFileNameEx(Hand, hMod, ModName, Sizeof(ModName)) > 0 then Result := ExtractFileName(ModName); except end; finally CloseHandle(Hand); end;end;end.
D7编译通过!
0 0
- 如何通过进程ID获取进程名
- 通过进程名获取进程ID
- linux通过进程名获取进程id
- 通过进程ID获取进程名
- 通过进程名获取进程ID
- 通过进程名获取进程id
- VC++ 通过进程名或进程ID获取进程句柄
- VC++ 通过进程名或进程ID获取进程句柄
- 通过进程ID得到进程名
- 通过进程名查找进程ID
- 通过进程ID得到进程名
- 通过进程ID得到进程名
- 通过进程ID得到进程名
- 通过进程名或进程ID获取进程句柄,窗口句柄
- 根据进程名获取进程id
- 进程管理:通过父进程ID获取子进程ID
- 通过PID获取进程名
- 通过EPROCESS获取进程名
- 第一课 Scala光速入门
- 朴素贝叶斯算法(分类算法)
- LeetCode: Two Sum
- 密码发生器
- 文件的打开
- 通过进程ID获取进程名
- baseAdapter自定义适配器千万注意
- HDU_2102_ A计划
- Hust oj 1189 区间最大值 II(线段树RMQ)
- Android SDK] Error when loading the SDK:
- Ubuntu下安装YaH3C
- Session与cookie
- 骨骼算法,仿生中的外观
- Poj 2718 Smallest Difference【dfs】