我現(xiàn)在想把CButton重新封裝下,一開始就遇見了問題,希望大家?guī)兔χ笇?dǎo)下
////////////////////////////////////////TCButton.h
#ifndef TCButton_H_
#define TCButton_H_
class TCButton:public CButton
{
public:
?//! Standard constructor.
?TCButton();
?//! Standard destructor.
?virtual ~TCButton();
};
#endif
////////////////////////////////////////TCButton.cpp
#include "stdafx.h"
#include "TCButton.h"
TCButton::TCButton()
{
?Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(0,0,40,20), this, 1);
}
TCButton::~TCButton()
{
}
現(xiàn)在我想在另外的Dailog中使用這個Button的話,我想實現(xiàn)
我想在堆內(nèi)存中TCButton myButton;
然后再進行父窗口的指定myButton.SetParent(CWnd* pWnd);
這樣的效果怎么做啊?
如果是new出來的好辦,我可以引用帶參數(shù)的構(gòu)造函數(shù),傳入
Create(_T("My button"), WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(0,0,40,20), this, 1)的第3個參數(shù)CWnd* pParentCwnd
,但是如果我聲明在.h文件中呢? 我不知道怎么做 呵呵
希望能給點提示:)