var
h:thandle;
f:boolean;
lppe:tprocessentry32;
H1: DWORD;
begin
h := CreateToolhelp32Snapshot(TH32cs_SnapProcess, 0);
lppe.dwSize := sizeof(lppe);
f := Process32First(h, lppe);
//lppe.szExeFile是进程的名字,自己挑选你要的
//lppe.th32ProcessID就是你要的进程号
while integer(f) <> 0 do
begin
if lppe.szExeFile = '程序名.exe' then
begin
break;
end;
f := Process32Next(h, lppe);
if integer(f) = 0 then Exit;
end;
H1 := lppe.th32ProcessID;
end;我现在已经得到进程的ID了。我想让这个进程的应用程序处于当前使用状态。比如,这个程序最小化在任务栏,我想让程序还原。
应该怎么实现?
h:thandle;
f:boolean;
lppe:tprocessentry32;
H1: DWORD;
begin
h := CreateToolhelp32Snapshot(TH32cs_SnapProcess, 0);
lppe.dwSize := sizeof(lppe);
f := Process32First(h, lppe);
//lppe.szExeFile是进程的名字,自己挑选你要的
//lppe.th32ProcessID就是你要的进程号
while integer(f) <> 0 do
begin
if lppe.szExeFile = '程序名.exe' then
begin
break;
end;
f := Process32Next(h, lppe);
if integer(f) = 0 then Exit;
end;
H1 := lppe.th32ProcessID;
end;我现在已经得到进程的ID了。我想让这个进程的应用程序处于当前使用状态。比如,这个程序最小化在任务栏,我想让程序还原。
应该怎么实现?
获取窗口进程ID:GetWindowThreadProcessId
匹配:if x = x then ....