Click here to Skip to main content
13,662,031 members
Rate this:
 
Please Sign up or sign in to vote.
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 9-Dec-09 12:05pm
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Does IsWindow or IsWindowVisible work?
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

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);
}
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180810.1 | Last Updated 22 Dec 2009
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100