function TfmLogin.FindProcess(AFileName: string): boolean;
var
hSnapshot : THandle;
lppe : TProcessEntry32;
Found : Boolean;
begin
Result := False;
hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
lppe.dwSize := SizeOf(TProcessEntry32);
Found := Process32First(hSnapshot, lppe);
while Found do
begin
if ((UpperCase(ExtractFileName(lppe.szExeFile))=UpperCase(AFileName)) or (UpperCase(lppe.szExeFile )=UpperCase(AFileName))) then
begin
Result := True;
end;
Found := Process32Next(hSnapshot, lppe);
end;
var
hSnapshot : THandle;
lppe : TProcessEntry32;
Found : Boolean;
begin
Result := False;
hSnapshot := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
lppe.dwSize := SizeOf(TProcessEntry32);
Found := Process32First(hSnapshot, lppe);
while Found do
begin
if ((UpperCase(ExtractFileName(lppe.szExeFile))=UpperCase(AFileName)) or (UpperCase(lppe.szExeFile )=UpperCase(AFileName))) then
begin
Result := True;
end;
Found := Process32Next(hSnapshot, lppe);
end;
end;
if not FindProcess('ScktSrvr.exe') then
begin
ShowMessage('scktsrvr.exe未启用!');
exit;
end;