BOOL CALLBACK DlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
static int SAGD=0;
//exit(0);
switch (Message)
{
case WM_CLOSE:
DestroyWindow(hwnd);
break;
case WM_COMMAND:
switch LOWORD(wParam){
case LOGON:{
MessageBox(hwnd, "LOGON", "LOGONMODE",
MB_OK | MB_ICONEXCLAMATION);
return TRUE;
}
break;
}
// Place message cases here.
default:
return FALSE;
}
}
🔒 Locked
Whats wrong with this simple code windows message code?
Advertisement
Original Post
quote:Uh, that is standard behaviour; check any similar dialog box. When you press the enter key, and no other button has the focus, the dialog will automatically send an IDOK command message, which have the default effect of closing the dialog.
Original post by kindfluffysteve
When I type something and press return in some edit box - its as though the login button was clicked.
You may be able to prevent it by adding a case for IDOK (or the ID of default button), and simply return 0. But, I wouldn''t suggest it; I think you should keep that feature.
well if thats normal behaviour - it doesnt seem much useful -
whanever i press return from any edit box, the logon button is activated.
whanever i press return from any edit box, the logon button is activated.
This is not directly related with your problem but I suggest you to:
-Change those "break;" statements into "return 0;".
-Change that "return FALSE;" into "return DefWindow (hwnd, Message, wParam, lParam);".
Just my two (euro)cents.
theNestruo
Syntax error in 2410
Ok
-Change those "break;" statements into "return 0;".
-Change that "return FALSE;" into "return DefWindow (hwnd, Message, wParam, lParam);".
Just my two (euro)cents.
theNestruo
Syntax error in 2410
Ok
quote:
Original post by theNestruo
-Change that "return FALSE;" into "return DefWindow (hwnd, Message, wParam, lParam);".
Don''t do that. Returning TRUE/FALSE is correct for _dialog_ functions. DefWindowProc() is for user-made windows (the ones that were created using CreateWindowEx()).
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement