var hSnapshot:THandle; lppe:TProcessEntry32; begin hSnapShot:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0); lppe.dwSize:=Sizeof(lppe); if Process32First(hSnapshot,lppe)then begin while Process32Next(hSnapshot,lppe) do begin showmessage(lppe.szExeFile);//当前应用程序的文件名 end;//end while end;//end if CloseHandle(hSnapshot); end; 这是我用来判断当前运行程序的代码,对你应该有帮助
hSnapshot:THandle;
lppe:TProcessEntry32;
begin
hSnapShot:=CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS,0);
lppe.dwSize:=Sizeof(lppe);
if Process32First(hSnapshot,lppe)then begin
while Process32Next(hSnapshot,lppe) do begin
showmessage(lppe.szExeFile);//当前应用程序的文件名
end;//end while
end;//end if
CloseHandle(hSnapshot);
end;
这是我用来判断当前运行程序的代码,对你应该有帮助
我把这段程序拷下来试了,编译时报错说TProcessEntry32、CreateToolhelp32Snapshot等没有定义,我是不是少了什么文件?