Click to See Complete Forum and Search --> : 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
Yiweihua
June 13th, 1999, 08:23 AM
this is a bug about MFC.
please Overrides the Message proc function
WM_SHOWWINDOW (OnShowWindow)
delete code in this function.
November 20th, 1999, 04:40 AM
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?
paulbright@hotmail.com
Rudolf
November 22nd, 1999, 01:40 AM
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
manoj chopra
November 22nd, 1999, 04:14 AM
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
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.