全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1616
推到 Plurk!
推到 Facebook!

請問程式中如何分辨是在Delphi的IDE中執行?

答題得分者是:hagar
領航天使
站長


發表:12216
回覆:4186
積分:4084
註冊:2001-07-25

發送簡訊給我
#1 引用回覆 回覆 發表時間:2002-09-23 14:25:29 IP:218.163.xxx.xxx 未訂閱
站長需要寫一個程式,在Delphi中編譯並執行時的畫面 與單獨執行檔獨立執行時的畫面要有所不同, 請問要用什麼指令來做判斷呢? 站長曾在某個網站看過類似的程式碼,但忘了在那看到的, 再次去各個Delphi討論區搜尋也找不到了, 煩請各位網友賜教,謝謝! ~~~Delphi K.Top討論區站長~~~
------
~~~Delphi K.Top討論區站長~~~
jieshu
版主


發表:42
回覆:894
積分:745
註冊:2002-04-15

發送簡訊給我
#2 引用回覆 回覆 發表時間:2002-09-23 16:10:44 IP:203.204.xxx.xxx 未訂閱
引言: 站長需要寫一個程式,在Delphi中編譯並執行時的畫面 與單獨執行檔獨立執行時的畫面要有所不同, 請問要用什麼指令來做判斷呢? 站長曾在某個網站看過類似的程式碼,但忘了在那看到的, 再次去各個Delphi討論區搜尋也找不到了, 煩請各位網友賜教,謝謝! ~~~Delphi K.Top討論區站長~~~
用ComponentState試試,我設計元件都是用這個判斷,Help如下: Describes the current state of the component, indicating when a component needs to avoid certain actions. type TComponentState = set of (csLoading, csReading, csWriting, csDestroying, csDesigning, csAncestor, csUpdating, csFixups, csFreeNotification, csInline); property ComponentState: TComponentState;
人生有夢,逐夢而行。 人若為善,福雖未至,禍已遠離。 人若為惡,禍雖未至,福已遠離。 http://www.taconet.com.tw/jieshu/
------
人生有夢,逐夢而行
人若為善,福雖未至,禍已遠離
人若為惡,禍雖未至,福已遠離
http://www.taconet.com.tw/jieshu/
雪豆豆
一般會員


發表:19
回覆:22
積分:13
註冊:2002-08-18

發送簡訊給我
#3 引用回覆 回覆 發表時間:2002-09-23 16:27:28 IP:203.75.xxx.xxx 未訂閱
用這種方式ㄌㄟ? var handle : Integer; begin handle := FindWindow(nil, 'Delphi 7'); If handle = 0 then Begin handle := findwindow(fname, nil); if handle <> 0 then halt; End; Application.Initialize; Application.Title := 'form1'; Application.CreateForm(Tform1, form1); Application.Run; end.
hagar
版主


發表:143
回覆:4056
積分:4445
註冊:2002-04-14

發送簡訊給我
#4 引用回覆 回覆 發表時間:2002-09-23 18:13:09 IP:211.22.xxx.xxx 未訂閱
參考 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.
unit Unit1;    interface    uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;    type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;    var
  Form1: TForm1;    implementation    {$R *.DFM}    function IsDebuggerPresent(): Boolean; external 'kernel32.dll';    procedure TForm1.Button1Click(Sender: TObject);
begin
  if IsDebuggerPresent() = True then
    ShowMessage( 'Debugger or IDE detected' )
  else
    ShowMessage( 'Debugger or IDE NOT detected' );
end;    end.
-- Everything I say is a lie.
領航天使
站長


發表:12216
回覆:4186
積分:4084
註冊:2001-07-25

發送簡訊給我
#5 引用回覆 回覆 發表時間:2002-09-23 19:22:38 IP:61.219.xxx.xxx 未訂閱
感謝jieshu,雪豆豆抽空幫忙回覆, hagar解決了我的問題! 感謝各位! ~~~Delphi K.Top討論區站長~~~
------
~~~Delphi K.Top討論區站長~~~
系統時間:2024-04-24 1:27:28
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!