GarrettHylltun Posted August 19, 2008 Posted August 19, 2008 Is it possible with AutoIT to catch the key presses from the multimedia keys, such as Play, Pause, Vol Up, Mute etc...? Err, at least on XP and up that is. Thanks, ~Garrett
dbzfanatic Posted August 19, 2008 Posted August 19, 2008 If you know the hex code (you can probably get it from an online list) you may be able to use _IsPressed(). Go to my website. | My Zazzle Page (custom products)Al Bhed Translator | Direct linkScreenRec ProSimple Text Editor (STE) [TUTORIAL]Task Scheduler UDF <--- First ever UDF!_ControlPaste() UDF[quote name='renanzin' post='584064' date='Sep 26 2008, 07:00 AM']whats help ?[/quote]
GarrettHylltun Posted August 19, 2008 Author Posted August 19, 2008 K, thanks... BTW, I didn't see that function in the help file... is it in there and I missed it? ~Garrett
AdmiralAlkex Posted August 19, 2008 Posted August 19, 2008 K, thanks... BTW, I didn't see that function in the help file... is it in there and I missed it?~GarrettIt's there, under "Misc Management". You may also want to check HotKeySet() in the helpfile. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
rasim Posted August 19, 2008 Posted August 19, 2008 GarrettHylltunTry this:expandcollapse popupGlobal Const $WH_KEYBOARD_LL = 13 Global Const $KEY = 257 Global Const $MMUTE = 173 Global Const $MVOLDOWN = 174 Global Const $MVOLUP = 175 Global Const $MNEXT = 176 Global Const $MPREV = 177 Global Const $MSTOP = 178 Global Const $MPLAY = 179 Global $pStub_KeyProc = DllCallbackRegister("_KeyProc", "int", "int;ptr;ptr") Global $hmod = DllCall("kernel32.dll","hwnd","GetModuleHandle","ptr",0) Global $hHook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", _ "int", $WH_KEYBOARD_LL, _ "ptr", DllCallbackGetPtr($pStub_KeyProc), _ "hwnd", $hmod[0], _ "dword", 0) $hHook = $hHook[0] While 1 Sleep(10) WEnd Func _KeyProc($nCode, $wParam, $lParam) If $nCode < 0 Then Local $aRet = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hHook, "int", $nCode, "wparam", $wParam, _ "lparam", $lParam) Return $aRet[0] EndIf Local $KBDLLHOOKSTRUCT = DllStructCreate("dword vkCode;dword scanCode;dword flags;dword time;ptr dwExtraInfo", $lParam) Local $vkCode = DllStructGetData($KBDLLHOOKSTRUCT, "vkCode") Local $iFlag = DllStructGetData($KBDLLHOOKSTRUCT, "flags") If $iFlag = 1 Then Switch $vkCode Case $MMUTE ConsoleWrite("!> Mute key pressed" & @LF) Case $MVOLDOWN ConsoleWrite("!> Vol down key pressed" & @LF) Case $MVOLUP ConsoleWrite("!> Vol up key pressed" & @LF) Case $MNEXT ConsoleWrite("!> Next key pressed" & @LF) Case $MPREV ConsoleWrite("!> Previous key pressed" & @LF) Case $MSTOP ConsoleWrite("!> Stop key pressed" & @LF) Case $MPLAY ConsoleWrite("!> Play key pressed" & @LF) EndSwitch EndIf EndFunc Func OnAutoItExit() DllCall("user32.dll", "int", "UnhookWindowsHookEx","hwnd", $hHook) DllCallbackFree($pStub_KeyProc) EndFunc
Andreik Posted August 19, 2008 Posted August 19, 2008 (edited) I think that you may use _IsPressed(). 7C-7F (F13 key - F16 key) 80H-87H (F17 key - F24 key) Edited August 19, 2008 by Andreik
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