doubletreemutt
asked on
Show MessageBox after CDialog is visible
I want a CDialog dialog to launch the MessageBox based on data it gets in OnInitDialog(). But the MessageBox must only be displayed after the dialog is visble.
How do I do this?
thanks
Doubletreemutt
How do I do this?
thanks
Doubletreemutt
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks roshmon that works perfectly.
Thanks also to Priyesh - I had tried your first and third solutions already - both displayed the MessageBox() before the dialog was visible. A timer would work but I was looking for something simpler like the OnPaint.
Doubletreemutt
Thanks also to Priyesh - I had tried your first and third solutions already - both displayed the MessageBox() before the dialog was visible. A timer would work but I was looking for something simpler like the OnPaint.
Doubletreemutt
like
ON_MESSAGE(WM_USER+101, OnUserMessage)
DECLARE_MESSAGE_MAP()
BOOL CMyDialog::OnInitDialog()
{
CDialog::OnInitDialog() ;
//acquire data?
PostMessage(WM_USER+101, 0, 0) ;
return TRUE ;
}
LRESULT CMyDialog::OnUserMessage(W
{
AfxMessageBox("Init done") ;
return 0 ;
}
add this line to your header
afx_msg LRESULT OnUserMessage(WPARAM wPar, LPARAM lPar) ;
or, you could start a timer from OnInitDialog after you acquire data, then have the message shown from the timer routine, and kill the timer, you could use a boolean variable to indicate if OnInitDialog is completed
or u could map ON_SHOW_WINDOW()
there might be more ways..