Solved

dialog box

Posted on 1998-01-27
7
815 Views
Last Modified: 2013-12-03
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?
0
Comment
Question by:marvinm
  • 4
  • 2
7 Comments
 
LVL 4

Expert Comment

by:tflai
ID: 1410400
You should try catching WM_COMMAND, and switch on LOWORD(wParam) on WM_TAB, WM_ESCAPE, etc.
0
 
LVL 1

Author Comment

by:marvinm
ID: 1410401
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
 
LVL 1

Author Comment

by:marvinm
ID: 1410402
Adjusted points to 200
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 4

Expert Comment

by:tflai
ID: 1410403
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
 
LVL 1

Author Comment

by:marvinm
ID: 1410404
I am not using a separate window class for the dialog box window.
0
 

Accepted Solution

by:
PhilC earned 200 total points
ID: 1410405
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
 
LVL 1

Author Comment

by:marvinm
ID: 1410406
did the trick.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

825 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question