开发者

Unicode / Russian characters and Win32 api [C++]

I'm trying to catch Russian characters with GetAsyncKeyState() 开发者_开发技巧win32 api, but apparently it doesn't seem to work except with English.

Any idea??

CODE:

                for(unsigned char c = 1; c < 255; c++){
                        SHORT rv = GetAsyncKeyState(c);
                    if(rv & 1){ // on press button down
                        string out = "";
                        if(c == 1)
                                out = "[LMOUSE]"; // mouse left
...


GetAsyncKeyState() lets you inspect virtual keys. A virtual key doesn't become a Russian glyph until the WM_KEYDOWN message is processed by Windows through TranslateMessage(), turning that message into a WM_CHAR based on the current keyboard layout.

Mapping a glyph back to a virtual key is possible with VkKeyScanEx(). This can get rapidly very complicated if the glyph is generated by dead keys. In other words, requiring more than one keystroke. No idea what a Russian keyboard layout looks like, ymmv.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜