Click here to Skip to main content
15,905,874 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

Does IsWindow or IsWindowVisible work?
 
Share this answer
 
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.
 
Share this answer
 
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);
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900