我想将虚拟键转换为 WideString。这就是我到目前为止...
function VKeytoWideString (Key : Word) : WideString;
var
WBuff : array [0..255] of WideChar;
KeyboardState : TKeyboardState;
UResult : Integer;
begin
GetKeyBoardState (KeyboardState);
UResult := ToUnicode(key, MapVirtualKey(key, 0), KeyboardState, WBuff, 0,0);
Result := WBuff;
case UResult of
0 : Result := '';
1 : SetLength (Result, 1);
2 :;
else
Result := '';
end;
end;
它总是返回 0 但为什么呢?请帮忙。