CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    May 1999
    Location
    Miami, Florida
    Posts
    242

    how can I call a dialog box after application is created, but before user can do anything

    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.


  2. #2
    Join Date
    Apr 1999
    Posts
    11

    Re: how can I call a dialog box after application is created, but before user can do anything

    You can call the modal dialog in InitApplication().

    Savitha.

  3. #3
    Join Date
    Apr 1999
    Posts
    306

    Re: how can I call a dialog box after application is created, but before user can do anything

    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,


  4. #4
    Join Date
    Apr 1999
    Posts
    4

    Re: how can I call a dialog box after application is created, but before user can do anything

    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.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured