How can I detect if my application is running under the IDE "Delphi 2007 .Net", there is something like DebugHook?
Bye.
Answer my own question.
uses System.Diagnostics;
function IDEDelphiNetRunning:Boolean;
Begin
Result:=Debugger.IsAttached;
End;
works fine for me.
Bye.
The IsDebuggerPresent() WinAPI call.
Something like:
Function IDEIsRunning : boolean;
begin
result := DebugHook <> 0;
end;
Might Suit.
The JEDI JclDebug.pas unit contains the following:
function IsDebuggerAttached: Boolean;
var
IsDebuggerPresent: function: Boolean; stdcall;
KernelHandle: THandle;
P: Pointer;
begin
KernelHandle := GetModuleHandle(kernel32);
@IsDebuggerPresent := GetProcAddress(KernelHandle, 'IsDebuggerPresent');
if @IsDebuggerPresent <> nil then
begin
// Win98+ / NT4+
Result := IsDebuggerPresent
end
else
begin
// Win9x uses thunk pointer outside the module when under a debugger
P := GetProcAddress(KernelHandle, 'GetProcAddress');
Result := DWORD(P) < KernelHandle;
end;
end;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With