function IsApPRunningInDelphi : boolean; var hKernelDll : THANDLE; proc_IsDebuggerPresent : TProcIsDebuggerPresent; 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 := LoadLibrary(kernel32); if (hKernelDll <> -1) then begin proc := GetProcAddress(hKernelDll, 'IsDebuggerPresent'); if (proc <> nil) then begin proc_IsDebuggerPresent := proc; result := proc_IsDebuggerPresent; useFindWindow := false; end; end; except end; end; if (UseFindWindow) then begin if FindWindow('TAppBuilder', Nil) <> 0 Then result := true else result := false; end; end;