-
Dialog will not close
My dialog will not close here is the msg handler and the resource.
Code:
// FUNCTIONS //////////////////////////////////////////////
BOOL CALLBACK PeerToPeerDialogProc(HWND hDlg,UINT msg,WPARAM wparam,LPARAM lparam)
{
switch (msg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch( LOWORD(wparam) )
{
case IDOK:
break;
case IDCANCEL:
EndDialog( hDlg, 0 );
return TRUE;
}
break;
}
return FALSE;
}
Excerpt from the resource:
Code:
IDD_DIALOGPEERTOPEER DIALOG DISCARDABLE 0, 0, 356, 196
STYLE WS_CHILD | WS_CAPTION
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "Peer to Peer Connection Dialog",IDC_STATIC,126,4,100,8
LTEXT "Resource Dialog Test",IDC_STATIC,25,20,73,12
DEFPUSHBUTTON "Button1",IDCANCEL,255,140,70,15
END
Finally the call to the dialog
Code:
if (KEY_DOWN(VK_BACK) || keyboard_state[DIK_BACK])
{
//ShowWindow(main_window_handle, SW_HIDE);
DialogBox(main_instance,MAKEINTRESOURCE(IDD_DIALOGPEERTOPEER),main_window_handle,PeerToPeerDialogProc);
//ShowWindow(main_window_handle, SW_SHOW);
}
-
IDOK certainly will not close. You aren't calling EndDialog() in it. Is that what you mean?
-
since the BUTTON has IDCANCEL won't it send this message to the dialog when pressed or does it send IDOK?
Anyhow doesn't hitting escape send IDCANCEL to the dialog procedure.
Both these attempts do not close the dialog.
In fact it doesn't respond to pressing the button at all.
-
oh, you don't have an OK button. I see. Well then you should probably remove the case.
I don't see a problem off hand. Have you debugged? Set a break point at the IDCANCEL location and see if you hit it.
-
I think I need the IDOK because when you hit enter the defaultbutton issues IDOK if it has focus and if you hit esc it isuues IDCANCEL according to Petzold (unless I misunderstood).
Anyhow I don't know how to use the debugger and just spent the last hour trying.
The program appears to freeze after displaying the dialog, no response, the button doesn't depress. I think I need to upload the code and provide a link, but I am feeling to lazy to look up the info about my isp webspace. Is there any free hosting for source code problems like this available?
-
Hurray!!!!!!!!!!!!!!!!!!!!:)
I changed the style of the dialog box from child to overlapped, now everything seems to be working and I can continue on.
Does anybody know what the style child for a dialogbox entails. I thought it just meant child window or somthing. Whatever it was it was causing my program to hang.
Shwew and I was consider giving up, while still in the learning phase.
-
My app allows you to set a flag for full screen/windowed.
The windowed app is overlapped with an overlapped dialog.
The full screen is popup with overlapped dialog.
I am experiencing near the same problem with the full screen as as I was having with the child dialog.
This time after the dialog closes and I show the hidden full screen pop up window it doesn't seem to have focus, no input nothing.
I think this is due to it being popup because the other version(windowed not full screen) works fine.
Any remarks? If it is focus how do I regain focus to my full screen window?