MFC对话框小结

消息传递:

AfxGetMainWnd()->Invalidate();   //向主窗口传递消息 
HWND hwnd = AfxGetMainWnd()->m_hWnd;  //获得主窗口句柄

VC++ MFC编程各种窗口句柄获取函数详解 http://liuzhigong.blog.163.com/blog/static/178272375201121052238445/
非模式对话框使用手记 http://blog.chinaunix.net/space.php?uid=11037679&do=blog&cuid=239464

文本框更新:

UpdateData() and Updatedata(TRUE) are the same.
UpdateData(TRUE) is used to copy the contents of the controls into the associated variables.
UpdateData(FALSE) is used to put the values in the variables to the associated controls.

 

模式对话框调用的销毁:

CDialog::Close() == CDialog::OnCancel() == CDialog::EndDialog(IDCANCEL)一样。

CDialog::OnOK() == CDialog::EndDialog(IDOK)

在模式对话框下,用CDialog::OnOK()或CDialog::OnCancel()以及CDialog::OnClose()关闭对话框。

参考:《模态对话框与非模态对话的几种销毁方法与区别》http://renjwjx.blog.51cto.com/811549/191320/


MFC中添加鼠标右击事件.(VC6.0):

1.单击Project|Add to Project|Components and Controls 
2.双击Visual C++ Components目录,选择Pop_up Menu组件 
3.单击Insert,确定 
4.在Add Pop_up menu to下拉列表中选择视图类对应工程的视图类 
5.单击OK就建立了默认的右键菜单 
6.修改右键菜单为你想要的右键菜单(修改ID值来实现)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值