アプリケーションが IDE "Delphi 2007 .Net" で実行されているかどうかを検出するにはどうすればよいですか? DebugHook のようなものがありますか?
さよなら。
アプリケーションが IDE "Delphi 2007 .Net" で実行されているかどうかを検出するにはどうすればよいですか? DebugHook のようなものがありますか?
さよなら。
私自身の質問に答えてください。
uses System.Diagnostics;
function IDEDelphiNetRunning:Boolean;
Begin
Result:=Debugger.IsAttached;
End;
私にとってはうまくいきます。
さよなら。
IsDebuggerPresent()WinAPI呼び出し。
何かのようなもの:
Function IDEIsRunning : boolean;
begin
result := DebugHook <> 0;
end;
合うかもしれません。
JEDI JclDebug.pas ユニットには以下が含まれます。
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;
embarcaderoから、このより一般的な回答を見つけました
IsDebuggerPresent()
WinAPI 呼び出しを使用します。C++ での例:
if (IsDebuggerPresent())
Label1->Caption = "debug";
else
Label1->Caption = "no debug";
function IsDebugMode():Boolean;
begin
Result:=False;
{$IFDEF DEBUG}
Result:=True;
{$ENDIF}
end;