Как отличить нажат правый или левый SHIFT?
Материал из DRKB
Как отличить нажат правый или левый SHIFT?[править | править код]
if ((Word(GetKeyState(VK_LSHIFT)) and $8000) <> 0) then
begin
end;
if ((Word(GetKeyState(VK_RSHIFT)) and $8000) <> 0) then
begin
end;
работает под Win NT/2000, но не работает под Win95.
Author: CHERRY
Source: Взято с Vingrad.ru http://forum.vingrad.ru
ID: 01473
В 95 катит следующее:
RSHIFT = 36h;
LSHIFT = 2Ah;
asm
in al, 60h
cmp al, 36h
jne @@exit
mov tt,1
@@exit:
end;
if tt = 1 then ShowMessage('Right Shift');
Author: Baa
Source: Взято с Vingrad.ru http://forum.vingrad.ru
ID: 01474
procedure TDecEditForm.Memo1KeyPress(Sender: TObject; var Key: Char);
var
s: string;
RL: Byte;
begin
if Key = Chr(VK_RETURN) then
begin
if (GetVersion() and $80000000) = 0 then
begin
// WIN NT/2000
if ((Word(GetKeyState(VK_LSHIFT)) and $8000) <> 0) then
begin
end;
if ((Word(GetKeyState(VK_RSHIFT)) and $8000) <> 0) then
begin
end;
end
else
begin
// WIN 9.x
asm
mov ah,2
int $16
mov RL,al
end;
if 1 = (RL and 1) then // ПРАВЫЙ SHIFT НАЖАТ+ENTER
begin
end;
if 2 = (RL and 2) then // ЛЕВЫЙ SHIFT НАЖАТ+ENTER
begin
end;
end;
end;
end;
end;
Author: CHERRY
Source: Взято с Vingrad.ru http://forum.vingrad.ru
ID: 01475