|
Posted by Gernot Frisch on March 2, 2006, 3:24 am
Please log in for more thread options
> For normal dialog boxes, the BACK key automatically sends a
> WM_COMMAND, IDCANCEL
> to the dialog proc, which I handle with an EndDialog, and control
> returns to the
> window that called DialogBox. But for one dialog box, this is not
> working. In
> order to get WM_CHAR and WM_KEYDOWN messages, I defined this dialog
> box with a
> private class ("MyTableClass"). In the code, I registered the
> class, making
> sure to use GetClassInfo(.."DIALOG"..) so that cbWndExtra is set
> appropriately.
> This registration associates my own MyWindowProc with"MyTableClass".
> MyWindowProc catches the WM_CHAR messages, etc., and then calls
> DefDlgProc, so
> that hopefully the effect will be as if DIALOG was the class for
> this dialog box
> all along. So I have both a Window Proc and a Dialog Proc for this
> dialog box.
> The arrangement works fine in every respect except the BACK key. It
> does not
> generate the WM_COMMAND, IDCANCEL as I had expected. So I
> explicitly added code
> to override the BACK key, as if there was an edit control in my
> dialog box.
> When I do that, I do get a WM_HOTKEY message which I then use to
> trigger an
> EndDialog. When I run the code, I see that the parent window of the
> dialog box
> does briefly appear. But then the screen changes to show the system
> Start menu.
> If I return to my application, the parent window is in control and
> the dialog
> box is gone. But why can’t I completely suppress the return to the
> Start menu?
Try RegisterHotKey, then you get these as WM_KEYDOWN only.
|