Okay, the subject says it all. Given a scancode, I want to get the ASCII code of the key pressed. The following function should do it, but I think I'm having a problem with a pointer.
function ScanToASCII(scancode: DWORD; PResult: PChar): Integer;
KBLayout := GetKeyboardLayout(0);
= False) then
Result := 0;
vk := MapVirtualKeyEx(scancode, 1, KBLayout);
Result := ToAsciiEx(vk, scancode, KBState, PResult, 0, KBLayout);
The above function is my conversion of the C function found at http://www.gamedev.net/reference/programming/directx/article842.asp
. I'm thinking that there's a problem with my usage of "PResult PChar" in place of the C function's "ushort* result" in the calling parameter list, but I can't seem to get it right. Any thoughts?