I'm at a loss on this one, not really even sure what code to post.
I have a c++ application. The initial window has an edit control, custom control, and menu. When the user presses F5, a new window open with its own message loop. The new window then opens a DialogBox, and is modal as expected.
The odd part is that the DialogBox seems to be hidden behind the 2nd window. I have to alt-tab to the first window, then alt-tab back to the second window to get to the dialog box.
If I cancel out of the DialogBox, the second window is destroyed (as expected), and a MessageBox is shown (as expected), but that message box seems to be hidden behind the first window. Again, I have to alt-tab twice to get the MessageBox to the forefront, and OK out of it.
Does anyone have any ideas what could cause this odd Pop-Under behavior with both the DialogBox and MessageBox?
Thanks!
Code to create the Dialog Box
INT_PTR ip = DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_AMBIGUOUS), this->hWnd, DlgAmbiguous);
Code for the DlgAmbiguous Proceduels
INT_PTR CALLBACK DlgAmbiguous(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
UNREFERENCED_PARAMETER(lParam);
switch (message)
{
case WM_INITDIALOG:
{
HWND hStaticTerm = GetDlgItem(hDlg, IDC_TERM);
SetWindowText(hStaticTerm, lpAmbiguousTerm);
if (wcscmp(lpAmbiguousTerm, L"canvas") == 0)
{
HWND hComboBox = GetDlgItem(hDlg, IDC_MEANING);
SendMessage(hComboBox, CB_ADDSTRING, NULL, reinterpret_cast<LPARAM>(_T("Program Window")));
SendMessage(hComboBox, CB_ADDSTRING, NULL, reinterpret_cast<LPARAM>(_T("Region in Program Window")));
}
return (INT_PTR)TRUE;
}
case WM_COMMAND:
if (LOWORD(wParam) == IDOK)
{
HWND hComboBox = GetDlgItem(hDlg, IDC_MEANING);
iAmbiguousResult = SendMessage(hComboBox, CB_GETCURSEL, NULL, NULL);
EndDialog(hDlg, iAmbiguousResult + 100);
return (iAmbiguousResult == -1) ? FALSE : TRUE;
}
else if (LOWORD(wParam) == IDCANCEL)
{
EndDialog(hDlg, DLG_CANCEL);
return (INT_PTR)FALSE;
}
break;
}
return (INT_PTR)FALSE;
FooBarWiz::DialogBox
, which has a convenient member functionput_in_right_place()
. I guess I should have read your code more carefully :-) – Kerrek SBwindows
andwinapi
are helpful to understand what platform and gui library you are using. – Jesse Good