monoceres Posted November 11, 2008 Posted November 11, 2008 Hi! Like I promised yesterday here's an UDF that changes the state of the keyboard's leds (Caps lock, Num lock & Scroll lock). You tell the UDF which buttons to lit/unlit by BitOR'ing (or plussing ) the constants in the top of the script. Keyboard_LED_Controller.au3 example.au3 Enjoy! Broken link? PM me and I'll send you the file!
JRSmile Posted November 11, 2008 Posted November 11, 2008 i was really supprised that this is possible, downloaded it as fast as i could and had sadly to see that it does not work with logitech G15 keyboards... $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-)
GtaSpider Posted November 11, 2008 Posted November 11, 2008 Same at mine G15v2 But tried it on other keyboard and it works. Very nice man. Nothing is impossible with AutoIt know i think (Except of acces to .NET^^) Spider www.AutoIt.de - Moderator of the German AutoIt Forum
Kreatorul Posted November 11, 2008 Posted November 11, 2008 Man you always write the coolest stuff. This would make a good prank for Fools Day for my sister. It even works on my laptop(capslock only).
monoceres Posted November 11, 2008 Author Posted November 11, 2008 Thanks all For those of you that the script doesn't work for: I think that the problem is that I assume that the default windows driver is used or something. Could you please post what's inside the reg key HKEY_LOCAL_MACHINE\HARDWARE\DeviceMap\KeyboardClass Broken link? PM me and I'll send you the file!
TehWhale Posted November 11, 2008 Posted November 11, 2008 Ugh, doesn't work for me. Heres what in there: Default (Value Not Set) \Device\KeyboardClass0 - - - - - - - \REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\kbdclass \Device\KeyboardClass1 - - - - - - - - \REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\kbdclass
monoceres Posted November 11, 2008 Author Posted November 11, 2008 Ugh, doesn't work for me.Heres what in there:Default (Value Not Set)\Device\KeyboardClass0 - - - - - - - \REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\kbdclass\Device\KeyboardClass1 - - - - - - - - \REGISTRY\MACHINE\SYSTEM\ControlSet001\Services\kbdclassHmm, try changing "\Device\KeyboardClass0" to "\Device\KeyboardClass1" in the _OpenKeyboard func. Broken link? PM me and I'll send you the file!
TehWhale Posted November 11, 2008 Posted November 11, 2008 Hmm, try changing "\Device\KeyboardClass0" to "\Device\KeyboardClass1" in the _OpenKeyboard func.Nope. Still doesn't work! I was looking forward to this too.
monoceres Posted November 11, 2008 Author Posted November 11, 2008 Nope. Still doesn't work! I was looking forward to this too. Hmm, too bad. I'll do some research and hopefully I will find a way to send this data to whatever keyboards. Broken link? PM me and I'll send you the file!
TehWhale Posted November 11, 2008 Posted November 11, 2008 Hmm, too bad. I'll do some research and hopefully I will find a way to send this data to whatever keyboards.If it helps, i'm using the standard Alienware keyboard.
monoceres Posted November 11, 2008 Author Posted November 11, 2008 (edited) Ok, I've got something.Try replacing "\Device\KeyboardClass0" to your keyboard's "Physical Device Object Name", which can be found in device manager: Edited November 11, 2008 by monoceres Broken link? PM me and I'll send you the file!
TehWhale Posted November 12, 2008 Posted November 12, 2008 DllCall("Kernel32.dll","int","DefineDosDeviceW","dword",$DDD_RAW_TARGET_PATH,"wstr","Keybd","wstr","\Device\000000c9") It says: \Device\000000c9 is my physical device object name, but its yet to work.
monoceres Posted November 12, 2008 Author Posted November 12, 2008 DllCall("Kernel32.dll","int","DefineDosDeviceW","dword",$DDD_RAW_TARGET_PATH,"wstr","Keybd","wstr","\Device\000000c9") It says: \Device\000000c9 is my physical device object name, but its yet to work. Damn, I really thought that would work, well I'm out of ideas. Google doesn't give you that much info either. I'll try asking at SysInternals forum tomorrow, they usually are pretty good with this low-level stuff. Broken link? PM me and I'll send you the file!
TehWhale Posted November 12, 2008 Posted November 12, 2008 Damn, I really thought that would work, well I'm out of ideas. Google doesn't give you that much info either. I'll try asking at SysInternals forum tomorrow, they usually are pretty good with this low-level stuff. I'll have to wait.
Wessi Posted September 12, 2011 Posted September 12, 2011 Hello, nothing happens here, why? First of all, thanx for this interesting code, monoceres.To get a handle for "normal" keyboards(PS/2) in KeyboardClass0 is easy, but getting a handle for HIDs(USB) is difficult.There a two different ways the OS handles such keyboards, native HID(with own driver) and/or emulated("USB Generic Parent Driver"/usbccgp).Maybe its possible to detect USB-keyb over this service or get the right keyb over the handler from kbdclass.sys over IRP_MJ_READ Maybe this helps:http://www.codeproject.com/KB/recipes/keystroke-hook.aspx #4.0http://mamedev.org/source/src/osd/windows/ledutil.c.htmlor with a dll like this:http://code.google.com/p/csharp-usb-hid-driver/downloads/listexplained here:http://www.florian-leitner.de/index.php/2007/08/03/hid-usb-driver-library/
dariel Posted November 19, 2017 Posted November 19, 2017 hi, i cant make this work, the _OpenKeyboard() func return me 0x0000000000000114 so i think he is getting the keyboard handle well, so the error must be in the _KeyboardSetLed() func, any ideas?, thanks.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now