ViaThinkSoft CodeLib
Dieser Artikel befindet sich in der Kategorie:
CodeLib → Programmierhilfen → Delphi
uses TlHelp32;
function IsDelphiRunning: boolean;
function ProcessExists(exeFileName: string): Boolean;
var
ContinueLoop: BOOL;
FSnapshotHandle: THandle;
FProcessEntry32: TProcessEntry32;
begin
FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
FProcessEntry32.dwSize := SizeOf(FProcessEntry32);
ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
Result := False;
while Integer(ContinueLoop) <> 0 do
begin
if ((UpperCase(ExtractFileName(FProcessEntry32.szExeFile)) =
UpperCase(ExeFileName)) or (UpperCase(FProcessEntry32.szExeFile) =
UpperCase(ExeFileName))) then
begin
Result := True;
end;
ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
end;
CloseHandle(FSnapshotHandle);
end;
var
sBuffer: String;
iCounter: Integer;
pcBuffer: PChar;
const
sWnd: string = 'UQspqfsuzJotqfdups'; // ROT-1 "TPropertyInspector" (only older versions of Delphi)
rot1_bcb32 = 'cdc43'; // ROT-1 "bcb32"
rot1_delphi = 'efmqij43'; // ROT-1 "delphi32"
rot1_bds = 'cet'; // ROT-1 "bds"
rot1_exe = '/fyf'; // ROT-1 ".exe"
begin
sBuffer := '';
for iCounter := 1 to Length(sWnd) do
sBuffer := sBuffer + chr(ord(sWnd[icounter])-1);
pcBuffer := AllocMem(512);
try
strpcopy(pcBuffer, sBuffer);
result := FindWindow(pcBuffer, nil) = 0;
finally
FreeMem(pcBuffer, 512);
end;
sBuffer := '';
for iCounter := 1 to Length(rot1_bcb32) do
sBuffer := sBuffer + chr(ord(rot1_bcb32[icounter])-1);
for iCounter := 1 to Length(rot1_exe) do
sBuffer := sBuffer + chr(ord(rot1_exe[icounter])-1);
result := result or processExists(sBuffer);
sBuffer := '';
for iCounter := 1 to Length(rot1_delphi) do
sBuffer := sBuffer + chr(ord(rot1_delphi[icounter])-1);
for iCounter := 1 to Length(rot1_exe) do
sBuffer := sBuffer + chr(ord(rot1_exe[icounter])-1);
result := result or processExists(pcBuffer);
sBuffer := '';
for iCounter := 1 to Length(rot1_bds) do
sBuffer := sBuffer + chr(ord(rot1_bds[icounter])-1);
for iCounter := 1 to Length(rot1_exe) do
sBuffer := sBuffer + chr(ord(rot1_exe[icounter])-1);
result := result or processExists(pcBuffer);
end;
Daniel Marschall
ViaThinkSoft Mitbegründer
ViaThinkSoft Mitbegründer