Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Access modal dialogs from application handle

Access modal dialogs from application handle

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    AeJai
    wrote on last edited by
    #1

    Okay this one is for the Gurus! I am trying to open multiple modal dialogs from a parent modal dialog. However, in modal dialogs only one child dialog can be opened at a time under a parent dialog. Therefore, I have to use the applications main window to have multiple modal dialogs opened and use a map to track which dialogs belong to the parent dialog. How can I get a handle or pointer to the childrens dialog windows to store them in my map (for the parent to track)? My goal is to close all the parent's children dialogs once the parent's has been closed. And also consistently close them out by calling theDlg->EndDialog(IDOK) when the parent dialog has been closed by clicking "OK" or theDlg->EndDialog(IDCANCEL) when the parent dialog has been closed by clicking "Cancel".

    S 1 Reply Last reply
    0
    • A AeJai

      Okay this one is for the Gurus! I am trying to open multiple modal dialogs from a parent modal dialog. However, in modal dialogs only one child dialog can be opened at a time under a parent dialog. Therefore, I have to use the applications main window to have multiple modal dialogs opened and use a map to track which dialogs belong to the parent dialog. How can I get a handle or pointer to the childrens dialog windows to store them in my map (for the parent to track)? My goal is to close all the parent's children dialogs once the parent's has been closed. And also consistently close them out by calling theDlg->EndDialog(IDOK) when the parent dialog has been closed by clicking "OK" or theDlg->EndDialog(IDCANCEL) when the parent dialog has been closed by clicking "Cancel".

      S Offline
      S Offline
      Stuart Dootson
      wrote on last edited by
      #2

      AeJai wrote:

      I am trying to open multiple modal dialogs from a parent modal dialog

      Multiple modal dialogs...so, which is active - there can only be one at a time. Also, once a modal dialog starts, the only way for it to communicate with its parent window is by exiting - it contains its own message loop rather than using its parent window's message loop.

      AeJai wrote:

      My goal is to close all the parent's children dialogs once the parent's has been closed

      A parent window cannot be closed if it has spawned a modal dialog. Just don't do it - 'multiple modal dialogs' is really a synonym for 'modeless dialogs', IMO. You can close the child modeless dialogs by posting WM_CLOSE messages to them, IIRC.

      A 1 Reply Last reply
      0
      • S Stuart Dootson

        AeJai wrote:

        I am trying to open multiple modal dialogs from a parent modal dialog

        Multiple modal dialogs...so, which is active - there can only be one at a time. Also, once a modal dialog starts, the only way for it to communicate with its parent window is by exiting - it contains its own message loop rather than using its parent window's message loop.

        AeJai wrote:

        My goal is to close all the parent's children dialogs once the parent's has been closed

        A parent window cannot be closed if it has spawned a modal dialog. Just don't do it - 'multiple modal dialogs' is really a synonym for 'modeless dialogs', IMO. You can close the child modeless dialogs by posting WM_CLOSE messages to them, IIRC.

        A Offline
        A Offline
        AeJai
        wrote on last edited by
        #3

        The reason the parent window can be closed is because its parent too is the main window's (i.e., (long)AfxGetMainWnd()->m_hWnd) as well as its children. This allows for all the modal dialogs to open and not continue in the code sequentially until OK or Cancel has been clicked. I need to open more dialogs from this parent dialog in order to compare and modify values (of the contents). I cannot use modeless dialogs because it continues computing without the user selecting OK or Cancel; it just creates the dialog and will create multiple dialogs of the same type or instance rather. I have been able to reactivate the dialog that has been opened already by using a PropertyFrame pointer. I cannot just close the dialogs via WM_CLOSE, but should prevent the parent dialog from closing as long as its children dialogs are opened. That too will be as difficult.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups