fonction IsApPRunningInDelphi : booléen;
var
hKernelDll : THANDLE ;
proc_IsDebuggerPresent : TProcIsDebuggerPresent;
useFindWindow : booléen;
proc : FARPROC;
commencer
useFindWindow := vrai;
si (Win32Platform = VER_PLATFORM_WIN32_NT) alors
commencer
// WinNt
essayer
hKernelDll := GetModuleHandle(kernel32);
si (hKernelDll = -1) alors
hKernelDll := LoadLibrary(kernel32);
si (hKernelDll <> -1) alors
commencer
proc := GetProcAddress(hKernelDll, 'IsDebuggerPresent');
si (proc <> nul) alors
commencer
proc_IsDebuggerPresent := proc;
résultat := proc_IsDebuggerPresent;
useFindWindow := faux;
fin;
fin;
sauf
fin;
fin;
si (UseFindWindow) alors
commencer
if FindWindow('TAppBuilder', Nil) <> 0 Alors
résultat := vrai
autre
résultat := faux;
fin;
fin;