Kod: Tümünü seç
function IsDelphiRunning:boolean;
begin
IsDelphiRunning:=FindWindow('TAppBuilder',nil)<>0;
end;
Kod: Tümünü seç
Function IsDelphiRunning:Boolean;
Begin
Result := not((FindWindow('TApplication', nil) = 0) or
(FindWindow('TAlignPalette', nil) = 0) or
(FindWindow('TPropertyInspector', nil) = 0) or
(FindWindow('TAppBuilder', nil) = 0));
End;

function IsDebuggerPresent(): Boolean; external 'kernel32.dll';參考 Borland 這篇 FAQ List:
Summary: The API' function IsDebuggerPresent() can recognize
Delphi IDE (at least version 5 which I tried) as well as and
3rd party debuggers.
Kod: Tümünü seç
procedure TForm1.Button1Click(Sender: TObject);
begin
if IsDebuggerPresent() = True then
ShowMessage( 'Debugger or IDE detected' )
else
ShowMessage( 'Debugger or IDE NOT detected' );
end;
Platform SDK: Debugging and Error Handling
IsDebuggerPresent
The IsDebuggerPresent function determines whether the calling process is being debugged by a user-mode debugger.
BOOL IsDebuggerPresent(void);
Parameters
This function has no parameters.
Return Values
If the current process is running in the context of a debugger, the return value is nonzero.
If the current process is not running in the context of a debugger, the return value is zero.
Remarks
This function allows an application to determine whether or not it is being debugged, so that it can modify its behavior. For example, an application could provide additional information using the OutputDebugString function if it is being debugged.
To determine whether a remote process is being debugged, use the CheckRemoteDebuggerPresent function.
To compile an application that uses this function, define the _WIN32_WINNT macro as 0x0400 or later. For more information, see Using the Windows Headers.