Click to See Complete Forum and Search --> : how can I call a dialog box after application is created, but before user can do anything
Erich Ruth
June 11th, 1999, 12:14 AM
I have an SDI application. How can I pop-up a modal dialog box after the application has arisen, but before the user can enter any data? I tried putting the code for a modal dialog box in OnInitDialog() and other places, but the dialog box pops-up too soon, before the application has fully been created.
Any response any one can give me will be greatly appreciated.
savitha
June 11th, 1999, 12:44 AM
You can call the modal dialog in InitApplication().
Savitha.
ric
June 11th, 1999, 03:39 AM
Try in the InitialUpdate() of your view class. If this does not work, try this - in the InitialUpdate set a timer that will send a message after half a second, in this message domodal the dialog and kill the timer. Having in mind the InitialUpdate() can be invoked more than once in SDI create a BOOL var that will be set to 1 in the constructor and set to 0 after the dialog has been displayed, put one if(BOOL) so that dialog will be never displayed. I haven't tried this so I do not know if it works. But once I got a similar problem and I was thinking of this way, but finally solved it using threads. I do not think that threads will help you now.
This is just an idea. No advice.
Regards,
Yangghi Min
June 11th, 1999, 04:01 AM
In InitInstance() member function of your CWinApp derived class,
you can find the lines similar to the following statements
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
Try to insert DoModal() function call just below the 'm_pMainWnd->UpdateWindow()'.
You can make your dialog box pop-up over your main window fully initialized.
Hope this will help you.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.