PRB: Using ToAscii() in Journal Record Hooks

Last reviewed: January 5, 1995
Article ID: Q99337
The information in this article applies to:
  • Microsoft Windows Software Development Kit (SDK) for Windows, version 3.1

SYMPTOMS

When a journal record hook procedure calls the ToAscii() function, dead keys are apparently no longer processed correctly due to a side effect.

CAUSE

The current implementation of ToAscii() determines whether the key that is currently being processed is a dead key; if yes, it collapses the next keystroke seen in the input stream with the dead key for Windows to display. This assumption is being made for Windows, which calls the ToAscii() function during normal processing of keystrokes. Calling ToAscii() in a journal record hook clears the flag that indicates the presence of a dead key; thus, the key combination will not be displayed correctly on the screen although it will appear correctly when the recorded key strokes are played back.

RESOLUTION

The journal record hook procedure should call the ToAscii() function twice with the same parameters when processing a dead key [that is, the call to ToAscii() returns -1]. This will reset the dead key flag internally.

Note that the source code for the ToAscii() function is publicly available because it resides in the keyboard device driver whose source is shipped with the Windows Device Development Kit (DDK).


Additional reference words: 3.10
KBCategory: kbprg kbprb
KBSubcategory: UsrHks


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 5, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.