Solved

Set NumLock State in Delphi 2.0

Posted on 1998-09-21
2
391 Views
Last Modified: 2010-05-18
How can I set the State of the NumLock Key in Windows 95 and NT 4.0? I tried the version listed in the win32 help file - it works with CapsLock and ScrollLock - but not with the NumLock. Does this depend on the manufactor of the PC?
Please give a "clean" solution - if possible without hardware direct access. (PTM@Datacomm.ch)
0
Comment
Question by:ptmcomp
2 Comments
 
LVL 1

Accepted Solution

by:
duke_n earned 100 total points
ID: 1340480
hi !
I had this problem before I found this somewhere.
Let's say you want to change the numlock state to the opposite:

procedure TMyForm.Button1Click(Sender: TObject);
  Var
    KeyState  :  TKeyboardState;
  begin
    GetKeyboardState(KeyState);
    if (KeyState[VK_NUMLOCK] = 0) then
      KeyState[VK_NUMLOCK] := 1
    else
      KeyState[VK_NUMLOCK] := 0;
    SetKeyboardState(KeyState);
  end;

0
 
LVL 10

Author Comment

by:ptmcomp
ID: 1340481
I'm surprised because in the winapi help is written that this does'nt work but indeed it does. Thanks for your prompt answer.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now