C++博客 联系 聚合 管理  

Blog Stats

文章分类(17)

收藏夹(2)

文章档案(18)

相册

Blogs

citywanderer



                                 (Figure 1-1.The Visual C++ MFC application build process. in 《inside vc.net》)
From Figure1.1 above, we can see that resource.h is the bridge between MFC files and Resource file. Any an ID value in resource.h corresponds to a control.
1、If haven't Resouce file, we can also create a control by Create function. For instance:
//in .h file
CButton m_nRTButton;
//in OnInitDialog() function
m_nRTButton.Create("RunTime", WS_CHILD|WS_VISIBLE|BS_AUTO3STATE, CRect(0,0,100,20), this, 100);
virtual BOOLCreate
(
LPCTSTRlpszCaption,
DWORDdwStyle,
constRECT&rect,
CWnd*pParentWnd,
UINTnID
);
nID can be any number if you will use it later, otherwise, the id number may conflict with
others.
2、If you want to change data between a control and a variable, here are three ways as
follow:
(1):DDX_Control(……)
……
(2):object = (Class*)GetDlgItem(nID)
The class must derive from CWND, and the data flow just from variable to control i think
(3):Create(……)
CButton m_nRTButton;
m_nRTButton.Create("RunTime", WS_CHILD|WS_VISIBLE|BS_AUTO3STATE, CRect(0,0,100,20), this, 100);
as above.
(4):create an object of the class corresponding to a resource.
Of cource if you want to generate a modeless dialog, you must use Create function, otherwise
, you can
posted on 2006-06-29 18:14 citywanderer 阅读(264) 评论(0)  编辑 收藏 引用 所属分类: C++

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理