News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Interesting Problem

Started by mfazio, March 02, 2007, 11:56:43 AM

Previous topic - Next topic

mfazio

I have come across an interesting problem to do with keyboard hooks and assembly....

When processing certain keystrokes, the ToAscii function is supposed to take various paramaters including, virtual key code, scan code, and keyboard state, and output the characters of a pressed key to a specified buffer in its character form. 

When implementing this function in assembly, toggle keys, and shift keys are not taken into account to produce conversions to uppercase, punctuation etc.

That is, if the capslock is on or the shif key is down, a lower case character is still returned to the buffer.... Under C or C++ the same section of code will perform such translations.... odd

Reading through the msdn archives i discovered a section which mentions TranslateMessage used in window message handling as being responsible for setting these toggle/shift paramaters... however implementing a message loop in my application seems to offer no solution.


Am i missing something? How can i get ToAscii to return the proper ascii conversion WITHOUT specifically checking the shift/caps lock key and setting the keyboard state myself?

Must implement some kind of window? even tho under C or C++ it is not required?