Solved

Set NumLock State in Delphi 2.0

Posted on 1998-09-21
2
398 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 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