DOCUMENT:Q99337 09-JUL-2000 [win16sdk] TITLE :PRB: Using ToAscii() in Journal Record Hooks PRODUCT :Microsoft Windows Software Development Kit PROD/VER:WINDOWS:3.1 OPER/SYS: KEYWORDS:kbHook kbInput kbKeyIn kbOSWin2000 kbSDKWin32 kbGrpDSUser kbOSWin310 ====================================================================== ------------------------------------------------------------------------------- The information in this article applies to: - Microsoft Windows Software Development Kit (SDK) 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 query words: ====================================================================== Keywords : kbHook kbInput kbKeyIn kbOSWin2000 kbSDKWin32 kbGrpDSUser kbOSWin310 Technology : kbAudDeveloper kbWin3xSearch kbSDKSearch kbWinSDKSearch kbWinSDK310 Version : WINDOWS:3.1 Issue type : kbprb ============================================================================= 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. Copyright Microsoft Corporation 2000.