How do I know if my program is running in Delphi?

zhaozj2021-02-11  216

Function isapprunningindelphi: boolean;

VAR

Hkerneldll: thandle;

Proc_IndebuggerPresent: tprocismebuggerpresent;

UsefindWindow: Boolean;

PROC: FARPROC;

Begin

UsefindWindow: = true;

IF (Win32Platform = Ver_Platform_Win32_NT) THEN

Begin

// Winnt

Try

Hkerneldll: = getModuleHandle (kernel32);

IF (hkerneldll = -1) THEN

Hkerneldll: = loadingLibrary (kernel32);

IF (Hkerneldll <> -1) THEN

Begin

Proc: = GetProcaddress (Hkerneldll, 'IsDebuggerPresent');

IF (Proc <> NIL) THEN

Begin

Proc_IndebuggerPresent: = proc;

Result: = proc_isdebuggerpresent;

UsefindWindow: = false;

END;

END;

Except

END;

END;

IF (usefindWindow)

Begin

IF FindWindow ('TappBuilder', NIL) <> 0 THEN

Result: = TRUE

Else

Result: = FALSE;

END;

END;

转载请注明原文地址:https://www.9cbs.com/read-5817.html

New Post(0)