Idle in a Dialog Box? [MFC]

Started by
3 comments, last by Galileo430 22 years, 8 months ago
For my current project I need to create a loading dialog. Thing is I need to create a dialog that will display.. then have a function called... then quit.. I find out how to do this.. Anyone have any ideas?
------------------------------------------------------------I wrote the best video game ever, then I woke up...
Advertisement
You just create a dialog resource, wap ctrl-w make a new dialog class, and include the header file in your main app. Add the function you want to the new dialog class.

The trick is you need to creat a "modeless" dialog, and instead of calling .DoModal you just call .Show(SW_SHOW) and then the main program will launch. Once that happens you whack the dialog.

Magmai Kai Holmlor
- Not For Rent
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Well, now I have a Assertion Error..

Assert Failed
::IsWindow(m_hWnd)

I can't figure it out..



Edited by - Galileo430 on July 24, 2001 2:07:23 PM
------------------------------------------------------------I wrote the best video game ever, then I woke up...
Did you create your dialog before calling Show()? if IsWindow fails, it oftn means the object either was never created or has gone out of scope.

Actually, backing up to your first post, you want to create a "Loading..." dialog box, no? You want it to quit after the function returns, right? Perhaps the dialog is being destroyed before the function ends (depends on how you call the function - inside the dialog?), and your reference to the dialog object after that is to an invalid object. Try this:
    class CLoadingDlg : public CDialog(){public:  void CallFuction( void * ); // uses function pointer to call actual function}...void LoadData( void );CLoadingDlg dlg;dlg.Show(SW_SHOW); // inherit CDialog functionalitydlg.CallFuntion( LoadData );dlg.Show(SW_HIDE); // SW_? can't remember// now either allow dlg to go out of scope or explicitly call destructor    

Hope it helps.

Edited by - Oluseyi on July 24, 2001 2:34:36 PM
Ah got it.. Thanks..
------------------------------------------------------------I wrote the best video game ever, then I woke up...

This topic is closed to new replies.

Advertisement