CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 1999
    Posts
    53

    Which message maps/function should I use to create a dialog/window automatically when apps starts up

    Can anybody provide me a source code in VC++5.0, which will create a MDI window and a dialog box automatically when the application starts up. I have some problem in doing that. I could'n figure out in what function/message map I can write that piece of code, wherever I do that, the window always getting covered by View window in one way or the other. Any help or clue is most welcome.

    Senior Consultant Cap Gemini America,LLC

  2. #2
    Guest

    Re: Which message maps/function should I use to create a dialog/window automatically when apps start

    Do following:
    Create new project "sam", choose MDI in Step 1. Click finish
    Create Dialod you want to display when app start.
    In samApp class
    Include "Dialog.h"
    In InitInstance()
    {
    CDialog *dlg = new CDialog();
    dlg->Create(CDialog::IDD);
    dlg->ShowWindow(SW_SHOW);
    // when you want show MDI call dlg->DestroyWindow();
    }
    LB_TMA



  3. #3
    Join Date
    May 1999
    Posts
    82

    Re: Which message maps/function should I use to create a dialog/window automatically when apps start

    If you use DoModal instead of ShowWindow it will insure your dialog will stay on top of your main window.


  4. #4
    Join Date
    May 1999
    Posts
    3

    Re: Which message maps/function should I use to create a dialog/window automatically when apps start

    Sorry. But you use ShowWindow that mean you use Modalless, MDI continue work while the Dialog show. Use DoModal the program will wait untill Dialog hide to continue.

    LB_TMA


  5. #5
    Join Date
    May 1999
    Posts
    78

    Re: Which message maps/function should I use to create a dialog/window automatically when apps start

    Not to mention that

    BOOL CTestApp::InitInstance()
    {
    AfxEnableControlContainer();

    CDtest dlg; //add this line
    dlg.DoModal();//and this line



    works as well


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