Problem/Question/Abstract:
How to turn the CapsLock on and off
Answer:
procedure SetLockKey(vcode: Integer; down: Boolean);
begin
if Odd(GetAsyncKeyState(vcode)) <> down then
begin
keybd_event(vcode, MapVirtualkey(vcode, 0), KEYEVENTF_EXTENDEDKEY, 0);
keybd_event(vcode, MapVirtualkey(vcode, 0), KEYEVENTF_EXTENDEDKEY
or KEYEVENTF_KEYUP, 0);
end;
end;
Call by:
SetLockKey(VK_CAPITAL, True); {caps lock down}
Nincsenek megjegyzések:
Megjegyzés küldése