forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


GetKeyState is there, but how about SetKeyState?

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up
View previous topic :: View next topic  
Author Message
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Mon Jan 12, 2004 9:00 pm    Post subject: GetKeyState is there, but how about SetKeyState? Reply with quote

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 Smile

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
View user's profile Send private message
FreezingFire
Admin Team


Joined: 23 Jun 2002
Posts: 3508

PostPosted: Mon Jan 12, 2004 10:03 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue Jan 13, 2004 12:06 am    Post subject: Reply with quote

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
View user's profile Send private message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Tue Jan 13, 2004 2:14 am    Post subject: Reply with quote

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 Smile
_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Tue Jan 13, 2004 6:50 am    Post subject: Reply with quote

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 Smile


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
View user's profile Send private message
CodeScript
Moderator Team


Joined: 08 Jun 2003
Posts: 1060
Location: India

PostPosted: Thu Jan 15, 2004 6:26 am    Post subject: Reply with quote

Hi Garrett
If you want a demo of that you can try this:

http://codescript.vdsworld.com/VDS5src/keybd_event.zip

_________________
Regards
- CodeScript
Arrow Give your application a professional look with the VDSGUI Extension
Back to top
View user's profile Send private message Visit poster's website
Garrett
Moderator Team


Joined: 04 Oct 2001
Posts: 2149
Location: A House

PostPosted: Thu Jan 15, 2004 6:35 am    Post subject: Reply with quote

CodeScript, thanks, I'll check it out Smile 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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> Advanced Help for VDS 5 & Up All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group