Tuesday, January 4, 2011

How to turn numlock on by code

This function may come in especially handy when creating billing/financial applications where the keypad is a must. What it does is when called turns the NumLock status to "on".

uses
  Windows;
...
procedure SetNumLockOn;
var
  KeyState: TKeyBoardState;
begin
  GetKeyboardState(KeyState);
  if GetKeyState(VK_NUMLOCK) = 0 then begin
    KeyState[VK_NUMLOCK] := 1;
    SetKeyboardState(KeyState);
  end;
end;

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Kang Iwan K-sev | Thank's for your visit To My Site - Ridwan Mulyana | Cibeureum