判断左右Shift

  • 主题发起人 主题发起人 import
  • 开始时间 开始时间
I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure WMKeyDown(var Message: TWMKEY); message WM_KEYDOWN; procedure WMKeyUp(var Message: TWMKEY); message WM_KEYUP;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.WMKeyDown(var Message: TWMKey);
begin
inherited;
//判断按下
if ((message.KeyData) and ($2a shl 16))=($2a shl 16) then
showmessage('Left shift pressed')
else if ((message.KeyData) and ($36 shl 16))=($36 shl 16) then
showmessage('Right shift pressed');
end;
procedure TForm1.WMKeyUp(var Message: TWMKEY);
begin
inherited;
//判断抬起
if ((message.KeyData) and ($2a shl 16)=($2a shl 16)) then
showmessage('Left shift up')
else if ((message.KeyData) and ($36 shl 16))=($36 shl 16) then
showmessage('Right shift Up');
end;
 
 

Similar threads

I
回复
0
查看
544
import
I
I
回复
0
查看
549
import
I
I
回复
0
查看
505
import
I
后退
顶部