模态对话框不起作用 [英] modal dialog box not working

查看:177
本文介绍了模态对话框不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  void  CEverDlg :: OnButton1()
{
straw dlg;

if (dlg.DoModal()== IDOK)
{


MessageBox( dfdfd < span class =code-string> dfdfd,MB_OK);

}
}





好​​吧......我清楚了......我做了很容易,但我有一个FTP CLIENT,其中包含服务器上文件的列表控件。用户右键单击列表控件并从上下文菜单中选择编辑HTML文件。



它处于测试模式...模态对话框有一个按钮即时通过消息框测试。但是当对话框关闭时,消息框才会弹出。



我无法将代码放在对话框中,因为有些变量不起作用。如hIConnect在另一个cpp文件中运行..所以没有办法将代码放在cpp文件中

解决方案

你必须在内部显示消息框 OnOK()吸管对话框的处理程序:

  void  straw :: OnOK()
{
MessageBox( dfdfd dfdfd,MB_OK);
CDialog :: OnOK();
}



当您现在按下吸管对话框中的确定按钮时,会显示消息框,并在关闭消息框后关闭吸管对话框。 / blockquote>

oK让它工作



刚刚在课堂视图中使用了类,并添加了按钮的Windows消息句柄它有效..


void CEverDlg::OnButton1() 
{
straw dlg;

if(dlg.DoModal() == IDOK)
{
	

MessageBox("dfdfd","dfdfd",MB_OK);

}
}



Ok..let me clear things up..i made it easy but accaully I have a FTP CLIENT with a a list control of the files on the server. the user right clicks the list control and selects "EDIT THE HTML FILE" from a context menu.

its in testing mode...the modal dialog has a button that im testing with a messagebox. but the messagebox only pops up when the the dialog is closed.

I can not put the code in the dialog its self because some varibles wouldn't work.such as hIConnect that gets on in the other cpp file ..so there is no way of putting the code in the cpp file

解决方案

You must show the message box from within the OnOK() handler of your straw dialog box:

void straw::OnOK()
{
    MessageBox("dfdfd","dfdfd",MB_OK);
    CDialog::OnOK();
}


When you now press the OK button in the straw dialog, the message box is shown and the straw dialog is closed after closing the message box.


oK GOT IT TO WORK

just played around with the classes in the classview and added a windows message handle of the button now it works..


这篇关于模态对话框不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆