CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2006
    Location
    beyond the pillars of hercules
    Posts
    295

    [RESOLVED] Multiple Modeless Dialogs (MFC)

    i have 2 dialogs , 1 is the "main" dialog and another 1 is a modeless dialog the it suppose to be opened several times simultaneously


    so each time i call a new instance of the modeless dialog i do this

    Code:
    CManager **FM_Dialog;  //global var that points to dialog class
    
    
    FM_Dialog[0] = new CManager;  //allocate a new instance of the dialog
    
    FM_Dialog[0]->Create(CManager::IDD,this);    //Show to user
    FM_Dialog[0]->ShowWindow(SW_SHOW);
    im getting an error of "Unhandled exception blah blah blah"
    on this line FM_Dialog[0] = new CManager;

    what im i doing wrong here?

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543

    Re: Multiple Modeless Dialogs (MFC)

    You need to allocate space for dialog pointers, like:

    #define MAX_DIALOGS 100

    CManager *FM_Dialog[MAX_DIALOGS];

    Or use some container:

    list<CManager*> FM_Dialog;

    CManager* pDialog = new CManager; //allocate a new instance of the dialog
    pDialog->Create(CManager::IDD,this); //Show to user
    pDialog->ShowWindow(SW_SHOW);
    FM_Dialog->push_back(pDialog);

  3. #3
    Join Date
    May 2006
    Location
    beyond the pillars of hercules
    Posts
    295

    Re: Multiple Modeless Dialogs (MFC)

    thank you Alex F

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