TeChNiCh
asked on
Keyboard Lights
I wonder how i can get the "Keyboard Ligths"
(NUM LOCK/CAPS LOCK/SCREEN LOCK) to all be turned on...
(NUM LOCK/CAPS LOCK/SCREEN LOCK) to all be turned on...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SundayBoys,
From the Win32 API help file:
Because the SetKeyboardState function alters the input state of the calling thread and not the global input state of the system, an application cannot use SetKeyboardState to set the NUM LOCK, CAPS LOCK, or SCROLL LOCK indicator lights on the keyboard.
DragonSlayer.
From the Win32 API help file:
Because the SetKeyboardState function alters the input state of the calling thread and not the global input state of the system, an application cannot use SetKeyboardState to set the NUM LOCK, CAPS LOCK, or SCROLL LOCK indicator lights on the keyboard.
DragonSlayer.
DragpmSlayer?F
try my code,it can change NUMLOCK lights.my OS is win98se.
Don't always trust Microsoft!
try my code,it can change NUMLOCK lights.my OS is win98se.
Don't always trust Microsoft!
:)
:-)
I think the code does not only sets the numlock light but also the numlock state!
The problem is that Windows now has a virtual system keyboard and you cannot fiddle with the keyboard controller anymore. It may be that your oly keyboard is USB which is not controlled by the keyboard controller.
The problem is that Windows now has a virtual system keyboard and you cannot fiddle with the keyboard controller anymore. It may be that your oly keyboard is USB which is not controlled by the keyboard controller.
We needed to control the LEDs (including the state) in win9x in our firm, too. We worked hard on that and finally found a method which works more or less reliable. But it works only in connection with our little keyboard driver.
We also tried the SetKeyboardState stuff, of course, but somehow it made problems. I don't remember exactly, what the problem was. I think, it was not reliable, on some keyboards it did work, on others it did not.
Regards, Madshi.
We also tried the SetKeyboardState stuff, of course, but somehow it made problems. I don't remember exactly, what the problem was. I think, it was not reliable, on some keyboards it did work, on others it did not.
Regards, Madshi.
hi.
Something like this?
procedure TurnAllOn;
var
keys: TKeyboardState;
begin
GetKeyboardState( keys );
keys[VK_NUMLOCK] := 1; {Num Lock}
keys[VK_CAPITAL] := 1; {Caps Lock}
keys[VK_SCROLL] := 1; {Scroll Lock}
SetKeyboardState(keys);
end;
procedure TurnAllOff;
var
keys: TKeyboardState;
begin
GetKeyboardState( keys );
keys[VK_NUMLOCK] := 0; {Num Lock}
keys[VK_CAPITAL] := 0; {Caps Lock}
keys[VK_SCROLL] := 0; {Scroll Lock}
SetKeyboardState(keys);
end;
Dennis
Something like this?
procedure TurnAllOn;
var
keys: TKeyboardState;
begin
GetKeyboardState( keys );
keys[VK_NUMLOCK] := 1; {Num Lock}
keys[VK_CAPITAL] := 1; {Caps Lock}
keys[VK_SCROLL] := 1; {Scroll Lock}
SetKeyboardState(keys);
end;
procedure TurnAllOff;
var
keys: TKeyboardState;
begin
GetKeyboardState( keys );
keys[VK_NUMLOCK] := 0; {Num Lock}
keys[VK_CAPITAL] := 0; {Caps Lock}
keys[VK_SCROLL] := 0; {Scroll Lock}
SetKeyboardState(keys);
end;
Dennis
TeChNiCh,
You have 10 of the 16 questions you've asked at Experts Exchange still open, dating back to March of 2001. That, to put it mildly, is a horrible grading record.
Part of being a member here is closing your questions. Please take care of these in short order.
https://www.experts-exchange.com/questions/20463499/Show-only-a-few-hits-at-the-time.html
https://www.experts-exchange.com/questions/20476242/UPDATE-table.html
https://www.experts-exchange.com/questions/20494438/Trying-to-delete-a-record.html
https://www.experts-exchange.com/questions/20098209/Memo1-Specify.html
https://www.experts-exchange.com/questions/20099958/Databases.html
https://www.experts-exchange.com/questions/20123196/Table-calculating.html
https://www.experts-exchange.com/questions/20163381/Print-text-to-printer-as-HTML.html
https://www.experts-exchange.com/questions/20166816/Keyboard-Lights.html
https://www.experts-exchange.com/questions/20180411/Listbox1-Columns.html
https://www.experts-exchange.com/questions/20254546/Download-HTML.html
Netminder
EE Admin
You have 10 of the 16 questions you've asked at Experts Exchange still open, dating back to March of 2001. That, to put it mildly, is a horrible grading record.
Part of being a member here is closing your questions. Please take care of these in short order.
https://www.experts-exchange.com/questions/20463499/Show-only-a-few-hits-at-the-time.html
https://www.experts-exchange.com/questions/20476242/UPDATE-table.html
https://www.experts-exchange.com/questions/20494438/Trying-to-delete-a-record.html
https://www.experts-exchange.com/questions/20098209/Memo1-Specify.html
https://www.experts-exchange.com/questions/20099958/Databases.html
https://www.experts-exchange.com/questions/20123196/Table-calculating.html
https://www.experts-exchange.com/questions/20163381/Print-text-to-printer-as-HTML.html
https://www.experts-exchange.com/questions/20166816/Keyboard-Lights.html
https://www.experts-exchange.com/questions/20180411/Listbox1-Columns.html
https://www.experts-exchange.com/questions/20254546/Download-HTML.html
Netminder
EE Admin
Administrative Action - Force Accepted
SpideyMod
Community Support Moderator @Experts Exchange
SpideyMod
Community Support Moderator @Experts Exchange
var KeyState: TKeyboardState;
begin
GetKeyboardState(KeyState)
Result := (KeyState[VK_NUMLOCK] and 1) = 1;
end;
procedure NumLockOn;
var KeyState: TKeyboardState;
begin
GetKeyboardState(KeyState)
KeyState[VK_NUMLOCK] := $01;
SetKeyboardState(KeyState)
end;
procedure NumLockOff;
var KeyState: TKeyboardState;
begin
GetKeyboardState(KeyState)
KeyState[VK_NUMLOCK] := $00;
SetKeyboardState(KeyState)
end;
// these tips can use with other keys ie. VK_CAPITAL, VK_SCROLL