| View previous topic :: View next topic |
| Author |
Message |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Mon Jan 12, 2004 9:00 pm Post subject: GetKeyState is there, but how about SetKeyState? |
|
|
Based on CodeScripts example for the GetKeyState api, I thought I'd
try to set keys using api's, but can't find an api to do this. The
SetKeyBoardState requires an array and doesn't allow me to set the
CAP key, which is basically what I'm trying to do, is either turn on or
off the CAP LOCK key.
I know there's vds made dlls for doing this, but I'm trying keep from
having to include an extra dll or two with the program I'm working on.
If anyone knows of an API or any other way to turn off or on the cap
lock key, I'd be very appreciative
Thanks,
-Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Mon Jan 12, 2004 10:03 pm Post subject: |
|
|
I think maybe the SetKeyboardState will work:
| Code: | BOOL SetKeyboardState(
LPBYTE lpbKeyState // address of array with virtual-key codes
); |
_________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Tue Jan 13, 2004 12:06 am Post subject: |
|
|
| Code: | Remarks
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. |
-Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Tue Jan 13, 2004 2:14 am Post subject: |
|
|
keybd_event API can do that I think. Also I had made a example to set the state of Num Scroll Caps but as far as I remember I never posted that one even on my site:( Anyway its very simple for you  _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Tue Jan 13, 2004 6:50 am Post subject: |
|
|
| CodeScript wrote: | keybd_event API can do that I think. Also I had made a example to set the state of Num Scroll Caps but as far as I remember I never posted that one even on my site:( Anyway its very simple for you  |
CodeScript, thanks! I didn't see that api earlier. DragonSphere, is that
the one you were going to use also? If so, you can still post whatever
code you have on that since I have nothing and will start from scratch
on this one.
Thanks,
-Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
|
| Back to top |
|
 |
Garrett Moderator Team
Joined: 04 Oct 2001 Posts: 2149 Location: A House
|
Posted: Thu Jan 15, 2004 6:35 am Post subject: |
|
|
CodeScript, thanks, I'll check it out I didn't have a chance to try
anything myself yet. I did look at the api, then of course put it off
because at first glance, I was not able to think the use of the api through
from mind to code.
-Garrett _________________ 'What you do not want done to yourself, do not do to others.' - Confucius (550 b.c. to 479 b.c.) |
|
| Back to top |
|
 |
|