A
awfigsk
Unregistered / Unconfirmed
GUEST, unregistred user!
function KeyHookProc(iCode:integer;wParam:WPARAM;lParam:LPARAM):LResult;stdcall;export;
var
cchar;
K:TKeyboardState;
s:string;
begin
ToAscii(wParam,((lParam and $0000FF00) shr 16),K,c,0);
Shared^.Keys[Shared^.KeyCount]:=c^
Inc(shared^.KeyCount);
if Shared^.KeyCount>=(Buffer_Size-1) then Shared^.KeyCount:=0
result:=0;
end;
当c为pchar类型时,第一个按键可以正确转换,第二个,第三个,,,后面的就不行。
[red]而我将c换成char型,传给toascii函数时@c,则可以正确转换各个按键.[/red]
这是为什么?还请各位大侠帮忙指点一下!谢谢!
function ToAscii(uVirtKey, uScanCode: UINT
const KeyState: TKeyboardState;
lpChar: PChar
uFlags: UINT): Integer
stdcall;
var
cchar;
K:TKeyboardState;
s:string;
begin
ToAscii(wParam,((lParam and $0000FF00) shr 16),K,c,0);
Shared^.Keys[Shared^.KeyCount]:=c^
Inc(shared^.KeyCount);
if Shared^.KeyCount>=(Buffer_Size-1) then Shared^.KeyCount:=0
result:=0;
end;
当c为pchar类型时,第一个按键可以正确转换,第二个,第三个,,,后面的就不行。
[red]而我将c换成char型,传给toascii函数时@c,则可以正确转换各个按键.[/red]
这是为什么?还请各位大侠帮忙指点一下!谢谢!
function ToAscii(uVirtKey, uScanCode: UINT
const KeyState: TKeyboardState;
lpChar: PChar
uFlags: UINT): Integer
stdcall;