WEB开发网
开发学院软件开发Delphi 怎样知道我的程序是否运行在DELPHI? 阅读

怎样知道我的程序是否运行在DELPHI?

 2006-02-04 13:34:42 来源:WEB开发网   
核心提示:function IsApPRunningInDelphi : boolean; var hKernelDll : THANDLE; proc_IsDebuggerPresent : TProcIsDebuggerPresent; useFindWindow : boolean; proc : FARPROC; beg
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;

Tags:怎样 知道 程序

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接