?
Solved

dialog box

Posted on 1998-01-27
7
Medium Priority
?
823 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
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 800 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

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

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

This article shows how to make a Windows 7 gadget that accepts files dropped from the Windows Explorer.  It also illustrates how to give your gadget a non-rectangular shape and how to add some nifty visual effects to text displayed in a your gadget.…
In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
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…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

752 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