Windows - ativar numlock para WinXP

Top  Previous  Next

procedure AtivarNumLock;

var

  KBState: TKeyboardState;

begin

  GetKeyboardState(KBState);

  if Boolean(KBState[VK_NUMLOCK]) then Exit;

 

  if Win32Platform = VER_PLATFORM_WIN32_NT then

  begin

    Keybd_Event(VK_NUMLOCK, MapVirtualKey(VK_NUMLOCK, 0), KEYEVENTF_EXTENDEDKEY, 0);

    Keybd_Event(VK_NUMLOCK, MapVirtualKey(VK_NUMLOCK, 0), KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP, 0);

  end

  else

  begin

    KBState[VK_NUMLOCK] := 1;

    SetKeyBoardState(KBState);

  end;

end;