線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1390
推到 Plurk!
推到 Facebook!

覆載CreateParams()

答題得分者是:RaynorPao
blowfish
一般會員


發表:8
回覆:35
積分:18
註冊:2002-12-02

發送簡訊給我
#1 引用回覆 回覆 發表時間:2003-02-05 02:17:53 IP:211.74.xxx.xxx 未訂閱
Dear All,    請教一個問題, 我有一個程式,需要覆載CreateParams(),所以先試著寫了一個簡單的程式來試試 ,可是卻會發生stack overflow的execption,真是令我百思不得其解,track程式時發現,當我create form時,會一直呼叫CreateParams(),可能時這才會造成exception吧...這是我猜的,可是又想不到其他的解決方法,只好來請大家幫幫忙了,範例程式如下:    
//--------------------------------------------------------------------    Form1:
//-------------------------------------------------------------------
class TForm1 : public TForm
{
__published:        
  TBitBtn *BitBtn1;
  void __fastcall BitBtn1Click(TObject *Sender);
private:        
public:
  __fastcall TForm1(TComponent* Owner);
};    __fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{}    void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
  TForm2 *frm2 = new TForm2(NULL);
  frm2->Visible = true;
}
//--------------------------------------------------------------------
Form2:
//--------------------------------------------------------------------
class TForm2 : public TForm
{
__published:        
private:        
protected:

  virtual void __fastcall CreateParams(TCreateParams &Params);    public:                
  __fastcall TForm2(TComponent* Owner);
};    __fastcall TForm2::TForm2(TComponent* Owner)
  : TForm(Owner)
{}
void __fastcall TForm2::CreateParams(TCreateParams &Params)
{      TForm::CreateParams(Params);
  Params.ExStyle = Params.ExStyle | WS_EX_APPWINDOW;    }    
麻煩各位高手幫忙一下,謝謝!! === Study, Study and Study ===
------
=== Study, Study and Study ===
RaynorPao
版主


發表:139
回覆:3622
積分:7025
註冊:2002-08-12

發送簡訊給我
#2 引用回覆 回覆 發表時間:2003-02-05 11:40:19 IP:61.221.xxx.xxx 未訂閱
引言: 我有一個程式,需要覆載CreateParams(),所以先試著寫了一個簡單的程式來試試 ,可是卻會發生stack overflow的execption,真是令我百思不得其解,track程式時發現,當我create form時,會一直呼叫CreateParams(),可能時這才會造成exception吧...這是我猜的,可是又想不到其他的解決方法,只好來請大家幫幫忙了,範例程式如下:
blowfish 你好: TCustomForm::CreateParams Initializes the window-creation parameter record when the form window is created. virtual void __fastcall CreateParams(Controls::TCreateParams &Params); Description The CreateWnd method calls CreateParams to initialize the parameters it passes to CreateWindowHandle. TCustomForm overrides CreateParams to customize the way the form creates its Windows representation after calling the parent class method. You should never need to override this method in the context of a form class. The fields of the Params parameter become the parameters to a call to the CreateWindowEx OS function. -- Enjoy Researching & Developing --
------
-- 若您已經得到滿意的答覆,請適時結案!! --
-- 欲知前世因,今生受者是;欲知來世果,今生做者是 --
-- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 --
blowfish
一般會員


發表:8
回覆:35
積分:18
註冊:2002-12-02

發送簡訊給我
#3 引用回覆 回覆 發表時間:2003-02-06 01:37:20 IP:211.74.xxx.xxx 未訂閱
引言: blowfish 你好: TCustomForm::CreateParams Initializes the window-creation parameter record when the form window is created. virtual void __fastcall CreateParams(Controls::TCreateParams &Params); Description The CreateWnd method calls CreateParams to initialize the parameters it passes to CreateWindowHandle. TCustomForm overrides CreateParams to customize the way the form creates its Windows representation after calling the parent class method. You should never need to override this method in the context of a form class. The fields of the Params parameter become the parameters to a call to the CreateWindowEx OS function.
謝謝RaynorPao老大的回答 照> ===
------
=== Study, Study and Study ===
RaynorPao
版主


發表:139
回覆:3622
積分:7025
註冊:2002-08-12

發送簡訊給我
#4 引用回覆 回覆 發表時間:2003-02-06 10:44:49 IP:203.73.xxx.xxx 未訂閱
引言: 謝謝RaynorPao老大的回答 照> < face="Verdana, Arial, Helvetica">
blowfish 你好:
(1)拜託別叫我老大,會很不好意思,而且我的 level 還不到那邊(謝謝)
( >
   >
備註:
可是我試過你的程式碼,並不會發生你說的  >
是不是你其他的程式碼造成的呢??    -- 
        
------
-- 若您已經得到滿意的答覆,請適時結案!! --
-- 欲知前世因,今生受者是;欲知來世果,今生做者是 --
-- 一切有為法,如夢幻泡影,如露亦如電,應作如是觀 --
blowfish
一般會員


發表:8
回覆:35
積分:18
註冊:2002-12-02

發送簡訊給我
#5 引用回覆 回覆 發表時間:2003-02-06 14:08:41 IP:203.70.xxx.xxx 未訂閱
引言:
blowfish 你好:
(1)拜託別叫我老大,會很不好意思,而且我的 level 還不到那邊(謝謝)
( >
   >
備註:
可是我試過你的程式碼,並不會發生你說的  >
是不是你其他的程式碼造成的呢??
< face="Verdana, Arial, Helvetica">    
果然是RaynorPao兄(叫這樣可以了吧)!!
一出手就解決了我的問題!!    而且在看過那篇>    === 

        
------
=== Study, Study and Study ===
系統時間:2024-05-05 19:17:28
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!