PRB: OFNHookProcOldStyle Doesn't Set Keyboard Focus By DefaultLast reviewed: April 2, 1997Article ID: Q166251 |
The information in this article applies to:
SYMPTOMSKeyboard inputs generate a system beep instead of affecting an old-style File Open dialog box that has a hook procedure installed.
CAUSEWhen you use a hook procedure with an old-style File Open dialog box, the keyboard focus is not set by default. Since the focus is not set to a valid control, keyboard input is disabled and generates a system beep.
RESOLUTIONTo prevent this behavior, an application should manually set the focus for the File Open dialog box. This can be accomplished by handling the WM_INITDIALOG message in the old-style hook procedure:
UINT APIENTRY HookProcOldStyle(HWND hDlg, UINT uMsgId, WPARAM wParam, LPARAM lParam) { switch (uMsgId){ // WPARAM of this message contains the handle of the control // to receive focus. case WM_INITDIALOG: SetFocus((HWND)wParam); return 1; ... default: return 0; } } |
Additional query words: 95
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |