CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Guest

    Dialog with property sheet hangs when opening modal dialog

    Hi! I'm writing an application where I have a settings dialog with a list box and a property sheet (so I can't just run DoModal on the property sheet). So, I've made a placeholder in my settings dialog and create the property sheet on top of the placeholder (exactly like the sample code in the CPropertySheet section on CodeGuru). My problem is this: when I from my settings dialog (which is modal) try to open another modal dialog (i.e. a MessageBox), the entire application hangs. I've made a really ugly workaround at the moment, so I can keep working. When I open the second modal dialog, I first delete the property sheet, and then I recreate it when the dialog returns. Obviously, this isn't a solution I can live with.

    Has anyone else had this problem? What do I do? Suggestions?

    Thanx

    / Mats K


  2. #2
    Join Date
    Jun 1999
    Location
    Beijing China
    Posts
    48

    Re: Dialog with property sheet hangs when opening modal dialog

    this is a bug about MFC.
    please Overrides the Message proc function
    WM_SHOWWINDOW (OnShowWindow)
    delete code in this function.




  3. #3
    Guest

    Re: Dialog with property sheet hangs when opening modal dialog

    I tried to override the WM_SHOWWINDOW as you said but still the program hangs when I try to open a Modal DialogBox.
    Can you be more specific or Can you please send a working program to my email?
    [email protected]



  4. #4
    Join Date
    Apr 1999
    Location
    Frankfurt, Germany
    Posts
    113

    Re: Dialog with property sheet hangs when opening modal dialog

    Hi,
    somewhere I read that the function OnActivate of CPropertySheet causes that problem. So, I overrode this function in my derived propsheet (one of those "ugly" empty functions...). Now I can call message boxes without the program to hang.
    HTH
    Rudolf


  5. #5
    Join Date
    Aug 1999
    Posts
    10

    Re: Dialog with property sheet hangs when opening modal dialog

    I have faced the same frustrating problem before.

    Problem:
    If main window (such as ur main dialog window)has propety sheet as child control is deactivated when keyboard focus is with any of the controls on any of the property pages, then the complete application hangs.

    Right now u face this problem on u pop up a message box but u will face this problem any time ur main window is deactivated (say by swithing to another application)

    Solution

    Override the OnDeactivate message handle of ur main dialog. I this function do the following:

    Find the window which has the current focus. (by GetFocus())

    if this window is a child of any of the propery pages(Child control in the property sheet)the disable this child control (Enable(FALSE))


    Override the OnActivate message handle of ur main dialog. I this function do the following:

    If u disabled any window in the OndDeactivate handler enable that window.


    After thought

    May just shifting focus to the list box on the main dialog in the OnDeactivate handler may work.
    (Have not tried this solution but the one given before works fine)


    bye for now

    Manoj Chopra









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