dialog box

I am using CreateDialog() to create a dialog box with an edit control, an OK button, and a cancel button.
On the WM_INITDIALOG message I am selecting all the text in the editbox, and setting focus to the editbox. The OK button is defined as the default button.
The Tab,Enter, and Escape Keys only beep.
Should't these be handled by default by returning IDOK,IDCANCEL, etc?
I have tried looking for WM_KEYDOWN message, and still nothing. Any Suggestions?
LVL 1
marvinmAsked:
Who is Participating?
 
PhilCConnect With a Mentor Commented:
You Need to alter your main processing loop:
....
while(GetMessage (&msg,NULL,0,0))
{
  if ((DialogWnd==NULL) || !IsDialogMessage(DialogWnd,&msg)) {
  TranslateMessage(&msg);
  DispatchMessage(&msg);
}
....

0
 
tflaiCommented:
You should try catching WM_COMMAND, and switch on LOWORD(wParam) on WM_TAB, WM_ESCAPE, etc.
0
 
marvinmAuthor Commented:
WM_TAB and WM_ESCAPE are not valid messages are they? they are undefined by my compiler. I've tried trapping WM_KEYDOWN and VK_RETURN,VK_ESCAPE, but this does not work.-mm
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
marvinmAuthor Commented:
Adjusted points to 200
0
 
tflaiCommented:
Did you use the default dialog message handler (only after you've caught all the WM_COMMAND, WM_INITDIALOG, ... etc)?

default:
  return DefDlgProc(hWndMain, msg, wParam, lParam);

0
 
marvinmAuthor Commented:
I am not using a separate window class for the dialog box window.
0
 
marvinmAuthor Commented:
did the trick.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.