【发布时间】:2014-01-28 15:25:42
【问题描述】:
我想做什么:
获取所有正在运行的进程的列表:processName(没有.exe)ProcessFullFilePathProcessMainWindowTitle 类似:
process1 c:\p1.exe TheprocessTitle
..............
非常重要:
我需要不会产生任何异常的工作代码(try catch)
我的代码:
我使用TLHelp32 获取名称列表:
var handler: THandle;
data: TProcessEntry32;
function GetName: string;
var i:byte;
begin
Result := '';
i := 0;
while data.szExeFile[i] <> '' do
begin
Result := Result + data.szExeFile[i];
Inc(i);
end;
end;
begin
Application.ShowMainForm := False;
handler := CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
if Process32First(handler, data) then
begin
ShowMessage(GetName());
while Process32Next(handler, data) do
ShowMessage(GetName());
end;
这不够,
我需要:名称路径标题
【问题讨论】:
-
这个问题似乎离题了,因为它太窄了
标签: delphi process kernel user32