Código
function tbKeyIsDown(const Key: integer): boolean;
begin
Result := GetKeyState(Key) and 128 > 0;
end;
{ Exemplos de uso: }
if tbKeyIsDown(VK_CONTROL) then
{ Tecla Ctrl pressionada }
if tbKeyIsDown(VK_MENU) then
{ Tecla Alt pressionada }
if tbKeyIsDown(VK_SHIFT) then
{ Tecla Shift pressionada }
if tbKeyIsDown(VK_F2) then
{ Tecla F2 pressionada} Qualquer tecla pode ser verificada. Para isto basta saber o código virtual (Virtual Key Code) da tecla. }
Planeta Delphi - www.planetadelphi.com.br - Todos os direitos reservados | Copyright 2001-2009