var
hInstance:LongInt;
begin
hInstance:=ShellExecute(0,'open','notepad.exe',nil,nil,SW_SHOW);
if hInstance<=32 then
begin
ShowMessage('Error');
end;
end;
判断程序的进程,如果有,则已打开,
var
lppe:tprocessentry32;
sshandle:thandle;
hh:hwnd;
found:boolean;
begin
sshandle:=createtoolhelp32snapshot(TH32CS_SNAPALL,0);
found:=process32first(sshandle,lppe);
while found do
try
if (uppercase(extractfilename(lppe.szExeFile))='你的程序名.EXE') then
showmessage('程序已打开‘);