Page 1 of 1 1
Topic Options
#190019 - 2008-10-04 09:31 AM GetKeyState and SetKeyState Using DynaWrapper
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
As part of my learning process, here is the fruit of my labor. Thanks to Arend for getting me started. You may have created a monster. It's 3:30am my time, and I have to be up in 4 hours... I'll review this again because I am afraid of what I may have missed.

? GetKeyState("Capslock")
? SetKeyState("Capslock","on")
 
Function GetKeyState($Key) dim $objDynaWrap $objDynaWrap=CreateObject("DynamicWrapper") if @error exit @error endif Select Case $key="ScrollLock" $key=&00000091 Case $key="CapsLock" $key=&00000014 Case $key="NumLock" $key=&00000090 endselect $=$objDynaWrap.Register("USER32.DLL","GetKeyState", "i=l", "f=s", "r=u") $GetKeyState=$objDynaWrap.GetKeyState($Key) EndFunction
Function SetKeyState($Key,$toggle) dim $rc if $toggle="on" $toggle="1" endif if $toggle="off" $toggle="0" endif if $key="Numlock" or $key="Capslock" if GetKeyState($key)<>$toggle $rc=Sendkeys("{" + $key + "}") endif endif EndFunction




Top
#190020 - 2008-10-04 10:20 AM Re: GetKeyState and SetKeyState Using DynaWrapper [Re: Allen]
Arend_ Moderator Offline
MM club member
*****

Registered: 2005-01-17
Posts: 1894
Loc: Hilversum, The Netherlands
Very nice \:D

Top
#190025 - 2008-10-05 06:35 AM Re: GetKeyState and SetKeyState Using DynaWrapper [Re: Arend_]
Allen Administrator Online   shocked
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4545
Loc: USA
I updated the SetKeyState, and it can now be found in the UDFs here:
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=190022&Main=25720#Post190022

Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.051 seconds in which 0.024 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org