PRB: OFNHookProcOldStyle Doesn't Set Keyboard Focus By Default (166251)
The information in this article applies to:
- Microsoft Platform Software Development Kit (SDK) 1.0
This article was previously published under Q166251 SYMPTOMS
Keyboard inputs generate a system beep instead of affecting an old-style
File Open dialog box that has a hook procedure installed.
CAUSE
When 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.
RESOLUTION
To 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;
}
}
Modification Type: | Minor | Last Reviewed: | 7/11/2005 |
---|
Keywords: | kbHook kbprb KB166251 |
---|
|