MFC对话框 [英] MFC dialog

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

问题描述



我怎么知道对话框是否完全显示.

我正在开发一个小型应用程序,在其中显示对话框后,我想在其中填充和错误.我怎么知道对话框是否完全显示?

现在,我在OnInitDialog()函数中显示错误,该函数仅显示错误消息框,而不显示整个对话框.清除错误消息框后,整个对话框就会出现.

任何帮助表示赞赏..

谢谢,
Dev

Hi,

How can i know whether a dialog is completely shown or not.

I am developing a small application, in which i want to populate and Error after the dialog is displayed. how can i know if the dialog is completely displayed or not?

right now i am showing the error in OnInitDialog() function, which shows only the error message box but not the entire dialog. the entire dialog is coming up once i clear the error message box.

any help is appreciated..

thanks,
Dev

推荐答案

IsWindowIsWindowVisible是否起作用?


WM_PAINT将是发布到您的第一条消息创建后的窗口.因此,如果您需要在创建窗口后立即进行操作,请将该代码放在OnPaint()处理程序的末尾.这将确保在您执行该代码时对话框可见(在您的情况下,该代码显示错误).

请小心确定要执行或不执行该代码的条件.因为WM_PAINT可能在一分钟内发布约数千次.
WM_PAINT would be the first message posted to your window after it''s created. So, if you need to do something immediately after the window is created, put that code at the end of your OnPaint() handler. This will ensure that your dialog is visible while you execute that code (the code to show an error, in your case).

Be careful to have a condition to decide if or not to execute that code. Because WM_PAINT may be posted something like thousand times in a minute.


您可以添加WM_TIMER方法:

You could add a WM_TIMER method:

BOOL CYourDlg::OnInitDialog()
{
  ..
  ..
  SetTimer(1, 1, NULL);
  return TRUE;
}

void CYourDlg::OnTimer(UINT nIDEvent)
{
  KillTimer(1);

  //display your stuff
  ..
  ..

  CDialog::OnTimer(nIDEvent);
}


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

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