S
S
solomka_ro2019-02-02 11:11:33
C++ / C#
solomka_ro, 2019-02-02 11:11:33

What is the difference in the behavior of the "ToAscii" function on windows 7 and windows 10?

I get the code of the pressed virtual key from the lowlevelkeyboardproc procedure (via SetWindowsHookExA). When trying to translate it into a readable form, I use “ToAscii(info.vkCode, info.scanCode, keyboardState, ascii, 0)”
I also tried:
“ToAscii(info.vkCode, MapVirtualKey!!(info.vkCode, 0.toUInt( )), keyboardState, ascii, 0)” and this gave the same result:
In windows 10, all English letters and other characters are detected correctly, but running on windows 7 displays unreadable characters.
It must be an encoding issue, but Windows-1251 is used in both cases.
I looked in the KN standard library, there is no way to work with encodings, and from the “C” world “ToAscii”, as you can see from the problem, behaves strangely.
Also, an interesting point, if I write system("cmd /c programm.exe") at the beginning, then the resulting characters become illegible on both versions of windows.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
pfemidi, 2019-02-02
@pfemidi

In "cmd /c programm.exe" the encoding is cp866 and not windows-1251. At least on Windows 7.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question