新建个对话框资源,把上面的“确定”“取消”按钮删了。自己添加个按钮(ID_Btn),给对话框添加类 TestModal。void TestModal::OnBnClickedBtn()
{
EndDialog (10); //期望能返回 10
}在 view 类随便找个能触发的地方,写上:TestModal wnd;
int result = wnd.DoModal();来测试 DoModal 返回值,但这窗口关不了,为什么?只能点左上角关闭,但返回2在 MSDN 上看到下面话,所以做上面的测试下,不知是哪弄错了?An int value that specifies the value of the nResult parameter that was passed to the CDialog::EndDialog member function, which is used to close the dialog box. ===========================void EndDialog(
int nResult
);This member function returns nResult as the return value of DoModal.
{
EndDialog (10); //期望能返回 10
}在 view 类随便找个能触发的地方,写上:TestModal wnd;
int result = wnd.DoModal();来测试 DoModal 返回值,但这窗口关不了,为什么?只能点左上角关闭,但返回2在 MSDN 上看到下面话,所以做上面的测试下,不知是哪弄错了?An int value that specifies the value of the nResult parameter that was passed to the CDialog::EndDialog member function, which is used to close the dialog box. ===========================void EndDialog(
int nResult
);This member function returns nResult as the return value of DoModal.
解决方案 »
- OnCreate函数上//SetWindowText("************公司");之后,拖到窗口原先的标题又把改的替换回来聊?
- VC++如何读取文本文件中特定数据
- 后缀名为exe.intermediate.manifest和exe.embed.manifest分别是什么文件啊?
- 怎么判断一个字节里的内容是中文的高位还是asc码?
- 我要将CListCtrl的某个item的背影高亮显示,怎么写代码?
- 谁买了《VC++数据库编程技术与实例》(沈炜 徐慧著的),一个小问题请教?
- 寻求解决方案
- 我的程序
- 怎样从文本文件读取数据入库?
- ado如何与foxpro数据库连接,除了用dsn外?
- 编译程序的时候出错.类型不能强制转换..
- 获取输入焦点的问题
要怎么改变 非模态对话框返回值?