Program hangs when focused...
-
I have a dialog-based MFC application. I create a prop sheet, add some pages to it, and display it. Everything works fine at first, but if I move focus away from the dialog (like alt-tabbing to another window or clicking on another window), if I try to view my application again it hangs. However, it will ONLY hang if I interact with the prop sheet (tab control) window. I play around all I want with dialog controls that aren't in the prop sheet or its prop pages, but the minute I touch anything having to do with the prop sheet, the dialog will hang in the manner I just described. Some other random things I've noticed: 1) If I do anything with the prop sheet (even something as simple as switch tabs), then move focus back to the main dialog by clicking one of the non-propsheet controls, the program will still hang when it gets focus back. 2) The program works perfectly fine while as long as it has focus. It's just when I switch to another window and then return that it hangs. 3) If I hit break in VC++6 while the program is hung, 99% of the time the message that my window is attempting to handle is WM_ACTIVATE (surprise surprise). Here's my main dialog's OnInitDialog function:
// make our tab control m_PropSheet = new CPropertySheet("Project Manager"); m_ThreadProperties = new ThreadPropertiesPage; m_PropSheet->AddPage(m_ThreadProperties); m_TestSpec = new TestSpecificationPage; m_PropSheet->AddPage(m_TestSpec); m_MapProts = new MapPrototypes; m_PropSheet->AddPage(m_MapProts); m_PersistPage = new PersistPage; m_PropSheet->AddPage(m_PersistPage); m_ProjViewPage = new ProjectViewPage; m_PropSheet->AddPage(m_ProjViewPage); m_ProjViewPage->SetPMDlg(this); m_PropSheet->Create(this,WS_CHILD,NULL); m_PropSheet->SetWindowPos(NULL,10,27, 750,300,NULL); m_PropSheet->ShowWindow(TRUE);
Nothin' much there. Thanks much for your help. -
I have a dialog-based MFC application. I create a prop sheet, add some pages to it, and display it. Everything works fine at first, but if I move focus away from the dialog (like alt-tabbing to another window or clicking on another window), if I try to view my application again it hangs. However, it will ONLY hang if I interact with the prop sheet (tab control) window. I play around all I want with dialog controls that aren't in the prop sheet or its prop pages, but the minute I touch anything having to do with the prop sheet, the dialog will hang in the manner I just described. Some other random things I've noticed: 1) If I do anything with the prop sheet (even something as simple as switch tabs), then move focus back to the main dialog by clicking one of the non-propsheet controls, the program will still hang when it gets focus back. 2) The program works perfectly fine while as long as it has focus. It's just when I switch to another window and then return that it hangs. 3) If I hit break in VC++6 while the program is hung, 99% of the time the message that my window is attempting to handle is WM_ACTIVATE (surprise surprise). Here's my main dialog's OnInitDialog function:
// make our tab control m_PropSheet = new CPropertySheet("Project Manager"); m_ThreadProperties = new ThreadPropertiesPage; m_PropSheet->AddPage(m_ThreadProperties); m_TestSpec = new TestSpecificationPage; m_PropSheet->AddPage(m_TestSpec); m_MapProts = new MapPrototypes; m_PropSheet->AddPage(m_MapProts); m_PersistPage = new PersistPage; m_PropSheet->AddPage(m_PersistPage); m_ProjViewPage = new ProjectViewPage; m_PropSheet->AddPage(m_ProjViewPage); m_ProjViewPage->SetPMDlg(this); m_PropSheet->Create(this,WS_CHILD,NULL); m_PropSheet->SetWindowPos(NULL,10,27, 750,300,NULL); m_PropSheet->ShowWindow(TRUE);
Nothin' much there. Thanks much for your help.Well, I've found that the dialog WILL in fact refresh itself if there's something new to display. For instance, if I'm debugging in visual studio, and I insert a breakpoint before a statement that does something to one of the controls in a property page (like,say, add a string to a listbox), the dialog refreshes itself without any problems. But if I'm debugging and I look at my source code and then try to look back at the window, I get the hang I was talking about before.
-
I have a dialog-based MFC application. I create a prop sheet, add some pages to it, and display it. Everything works fine at first, but if I move focus away from the dialog (like alt-tabbing to another window or clicking on another window), if I try to view my application again it hangs. However, it will ONLY hang if I interact with the prop sheet (tab control) window. I play around all I want with dialog controls that aren't in the prop sheet or its prop pages, but the minute I touch anything having to do with the prop sheet, the dialog will hang in the manner I just described. Some other random things I've noticed: 1) If I do anything with the prop sheet (even something as simple as switch tabs), then move focus back to the main dialog by clicking one of the non-propsheet controls, the program will still hang when it gets focus back. 2) The program works perfectly fine while as long as it has focus. It's just when I switch to another window and then return that it hangs. 3) If I hit break in VC++6 while the program is hung, 99% of the time the message that my window is attempting to handle is WM_ACTIVATE (surprise surprise). Here's my main dialog's OnInitDialog function:
// make our tab control m_PropSheet = new CPropertySheet("Project Manager"); m_ThreadProperties = new ThreadPropertiesPage; m_PropSheet->AddPage(m_ThreadProperties); m_TestSpec = new TestSpecificationPage; m_PropSheet->AddPage(m_TestSpec); m_MapProts = new MapPrototypes; m_PropSheet->AddPage(m_MapProts); m_PersistPage = new PersistPage; m_PropSheet->AddPage(m_PersistPage); m_ProjViewPage = new ProjectViewPage; m_PropSheet->AddPage(m_ProjViewPage); m_ProjViewPage->SetPMDlg(this); m_PropSheet->Create(this,WS_CHILD,NULL); m_PropSheet->SetWindowPos(NULL,10,27, 750,300,NULL); m_PropSheet->ShowWindow(TRUE);
Nothin' much there. Thanks much for your help.