Hi.
I have a dialog, with a textedit-controll.. it looks like this in the resource-script:
Code:
CONNECTBOX DIALOG DISCARDABLE 30, 30, 250, 70
FONT 8, "MS Sans Serif"
BEGIN
CTEXT "Enter the IP adress you want to contact",IDC_STATIC,57,0,140,8
EDITTEXT ID_IPADRESS,75,20,100,80
DEFPUSHBUTTON "Connect",ID_CONNECT_OK,85,50,40,20
DEFPUSHBUTTON "Cancel",ID_CANCLEIP,130,50,40,20
END
Now, i start it up by doing this in the main windowprocedure:
Code:
case IDM_CONNECT:
DialogBox(hInstance,"CONNECTBOX",hwnd,ConnectDlgProc);
break;
And this is the DialogProcedure:
Code:
BOOL CALLBACK ConnectDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
static HWND hwndDlgIP;
switch(message) {
case WM_INITDIALOG:
hwndDlgIP=GetDlgItem(hDlg,ID_IPADRESS);
SendMessage(hwndDlgIP,EM_SETPASSWORDCHAR,'*',0);
SetFocus(hwndDlgIP);
return FALSE;
case WM_COMMAND:
switch(LOWORD(wParam)) {
case ID_CANCLEIP:
EndDialog(hDlg,FALSE);
return TRUE;
case ID_CONNECT_OK:
EndDialog(hDlg,FALSE);
return TRUE;
}
}
return FALSE;
}
It works. Whats the problem?
If the Text-edit-controll has the inputfocus, and "return" or '\r'
is pressed, the whole dialogwindow just goes down.
I even tried to override it by using windows-subclassing, but the whole dialog goes down, even then!
If i try to press return, when the inputfocus is not on the textedit, it works fine...