CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 1999
    Location
    Delaware, USA
    Posts
    12

    How to make a modal dialog temporarily go away

    I have a modal dialog which I need to push out of the way for a few moments so the user can interact with the main window in the same application. How can I do this? I can't use a modeless dialog because I need to hold up processing until the dialog closes. Any ideas?

    Kevin


  2. #2
    Join Date
    May 1999
    Posts
    31

    Re: How to make a modal dialog temporarily go away

    Perhaps you could use ShowWindow(SW_HIDE) to hide the dialog, then ShowWindow(SW_SHOW) to bring it back.

    Daniel.


  3. #3
    Join Date
    Apr 1999
    Location
    Delaware, USA
    Posts
    12

    Re: How to make a modal dialog temporarily go away

    That will hide the dialog, but it still holds the input focus away from other windows in the same application.


  4. #4
    Join Date
    May 1999
    Posts
    31

    Re: How to make a modal dialog temporarily go away

    Perhaps you could integrate whatever it is that is being done in the main window into the dialog.


  5. #5
    Guest

    Re: How to make a modal dialog temporarily go away

    Just call "CWnd::EnableWIndow()" on the parent or whatever window you want to re-enable (passing TRUE) and pass it FALSE again when done.


  6. #6
    Join Date
    Apr 1999
    Posts
    27,449

    Re: How to make a modal dialog temporarily go away

    You can't interact with the main application if
    the dialog is modal. That's the definition of
    modal. What you want to do is not what a modal
    dialog was designed for. Unless you want to get
    into some real low-level programming, a modal
    dialog will always keep the focus until the
    dialog is closed.

    Unless if I'm wrong, the reason for this is that
    a modal dialog has its own local message pump.
    The main app message pump is disabled. Therefore
    all messages are blocked from the main
    application.

    What you want is either to redo the
    interface, or create a modeless dialog and
    programatically control how things work if the
    dialog is visible or shut down. You may not have
    known it, but you gave yourself the hint as to
    how to solve this problem ("I need to hold up
    processing until the dialog closes") ;-)

    For example, when you display the modeless
    dialog, send a user-defined message to your app
    that whatever processing should stop. When the
    user closes the dialog, send another user defined
    message (maybe even the same message with a
    different wParam or something) notifying that
    processing should start again.

    Take it from there.

    Regards,

    Paul McKenzie



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