提供一个思路: 枚举系统中所有的进程,判断它的可执行文件的名字是不是那个程序的就行了! uses tlhelp32;var lppe:tprocessentry32; sshandle:thandle; found:boolean; begin sshandle:=createtoolhelp32snapshot(th32cs_snapail,0); found:=process32first(sshandle,lppe); while found do begin //进行你的处理其中lppe.szExefile就是程序名。 if uppercase(extractfilename(lppe.szexefile))=uppercase('abcd.exe') then showmessage('Already Run!'); found:=proccess32next(sshandle,lppe); end; end;
枚举系统中所有的进程,判断它的可执行文件的名字是不是那个程序的就行了!
uses tlhelp32;var
lppe:tprocessentry32;
sshandle:thandle;
found:boolean;
begin
sshandle:=createtoolhelp32snapshot(th32cs_snapail,0);
found:=process32first(sshandle,lppe);
while found do
begin
//进行你的处理其中lppe.szExefile就是程序名。
if uppercase(extractfilename(lppe.szexefile))=uppercase('abcd.exe') then
showmessage('Already Run!');
found:=proccess32next(sshandle,lppe);
end;
end;
救命啊
if GetForegroundWindow = Handle then 你的窗口被激活 else 你的窗口不被激活
上述语句放在哪,用TTimer吗?