Miranda Posted July 4, 2009 Share Posted July 4, 2009 (edited) I used #include <Misc.au3> Sleep(5000) WinActivate("BattleForge") HotKeySet("{Esc}", "_Exit") Dim $s_keys[117] = [116, _ "01", "02", "04", "05", "06", "08", "09", "0C", "0D", "10", _ "11", "12", "13", "14", "1B", "20", "21", "22", "23", "24", _ "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", _ "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", _ "41", "42", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", _ "4D", "4E", "4F", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", _ "5A", "5B", "5C", "60", "61", "62", "63", "64", "65", "66", _ "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", "70", _ "71", "72", "73", "74", "75", "76", "77", "78", "79", "7A", _ "7B", "7C", "7D", "7E", "7F", "80H", "81H", "82H", "83H", "84H", _ "85H", "86H", "87H", "90", "91", "A0", "A1", "A2", "A3", "A4", "A5"] $dll = DllOpen("user32.dll") While 1 Sleep(100) For $y = 1 To $s_keys[0] If _IsPressed ($s_keys[$y], $dll) Then MsgBox(0, "I saw that one!", $s_keys[$y]) EndIf Next WEnd Func _Exit() DllClose($dll) Exit EndFuncto test it, and no MsgBoxes appear whilst ingame, work fine anywhere else though.(credit for that code goes to gary, got it off an old post from someone else who credited gary back in 2006)In several years of using _ispressed() to control VLC from within games and other applications I've never had it not work, up until a month ago, when I stumbled on Battleforge.It's a free 2 play game, so if anyone feels up to it they can give it a try for themselves: www.battleforge.comIf anyone has any insight, I'd be mighty glad!Oh, I use Windows Vista 64bit.Oh, another thing... Winamp, which supports default multimedia keys "Will process media related WM_APPCOMMAND messages - see MSDN" has those keys working, also the regular global hotkeys work.HotKeySet doesn't work either...Thanks for any and all replies! Edited July 5, 2009 by Miranda Link to comment Share on other sites More sharing options...
Miranda Posted July 4, 2009 Author Share Posted July 4, 2009 Further Info: TeamSpeak's DirectInput hotkeys don't work either. Link to comment Share on other sites More sharing options...
Miranda Posted July 5, 2009 Author Share Posted July 5, 2009 Oh, and also, my Logitech mouse loses all it's special keybindings and acts just like any old 2 button mouse with a wheel, any buttons with different assignments are ignored, so it has to be some kind of cheat prevention (I'd guess). Anyone have any idea for a workaround, or where I could start looking? Link to comment Share on other sites More sharing options...
wolf9228 Posted July 5, 2009 Share Posted July 5, 2009 (edited) I used #include <Misc.au3> Sleep(5000) WinActivate("BattleForge") HotKeySet("{Esc}", "_Exit") Dim $s_keys[117] = [116, _ "01", "02", "04", "05", "06", "08", "09", "0C", "0D", "10", _ "11", "12", "13", "14", "1B", "20", "21", "22", "23", "24", _ "25", "26", "27", "28", "29", "2A", "2B", "2C", "2D", "2E", _ "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", _ "41", "42", "44", "45", "46", "47", "48", "49", "4A", "4B", "4C", _ "4D", "4E", "4F", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59", _ "5A", "5B", "5C", "60", "61", "62", "63", "64", "65", "66", _ "67", "68", "69", "6A", "6B", "6C", "6D", "6E", "6F", "70", _ "71", "72", "73", "74", "75", "76", "77", "78", "79", "7A", _ "7B", "7C", "7D", "7E", "7F", "80H", "81H", "82H", "83H", "84H", _ "85H", "86H", "87H", "90", "91", "A0", "A1", "A2", "A3", "A4", "A5"] $dll = DllOpen("user32.dll") While 1 Sleep(100) For $y = 1 To $s_keys[0] If _IsPressed ($s_keys[$y], $dll) Then MsgBox(0, "I saw that one!", $s_keys[$y]) EndIf Next WEnd Func _Exit() DllClose($dll) Exit EndFunc to test it, and no MsgBoxes appear whilst ingame, work fine anywhere else though. (credit for that code goes to gary, got it off an old post from someone else who credited gary back in 2006) In several years of using _ispressed() to control VLC from within games and other applications I've never had it not work, up until a month ago, when I stumbled on Battleforge. It's a free 2 play game, so if anyone feels up to it they can give it a try for themselves: www.battleforge.com If anyone has any insight, I'd be mighty glad! Oh, I use Windows Vista 64bit. Oh, another thing... Winamp, which supports default multimedia keys "Will process media related WM_APPCOMMAND messages - see MSDN" has those keys working, also the regular global hotkeys work. HotKeySet doesn't work either... Thanks for any and all replies!Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) Or Return False expandcollapse popup#include <WinAPI.au3> #include <WindowsConstants.au3> #include <StructureConstants.au3> #include <Constants.au3> Run("Notepad.exe", "", @SW_MAXIMIZE) Sleep(2000) Local $hWnd = WinGetHandle("Untitled - Notepad") RegisterWindowsHookEx($hWnd) While 1 Sleep(100) WEnd Func RegisterWindowsHookEx($hWnd) Global $hStub_KeyProc , $hmod ,$hHook , $WinH = $hWnd $hStub_KeyProc = DllCallbackRegister("_KeyProc", "long", "int;wparam;lparam") $hmod = _WinAPI_GetModuleHandle(0) $hHook = _WinAPI_SetWindowsHookEx($WH_KEYBOARD_LL, DllCallbackGetPtr($hStub_KeyProc), $hmod) Return $hHook EndFunc Func _KeyProc($nCode, $wParam, $lParam) Local $tKEYHOOKS $tKEYHOOKS = DllStructCreate($tagKBDLLHOOKSTRUCT, $lParam) If $nCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndIf If $wParam = $WM_KEYDOWN Then Local $code = DllStructGetData($tKEYHOOKS, "vkCode") Local $Win_H = _WinAPI_GetForegroundWindow() if $code < 166 And $WinH = $Win_H Then ; code From 01 to A5 ;from 0 to 165 MsgBox(0, "I saw that one!", Hex($code, 2)) Return False ;Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) Or Return False EndIf Else Local $flags = DllStructGetData($tKEYHOOKS, "flags") Switch $flags Case $LLKHF_ALTDOWN ConsoleWrite("$LLKHF_ALTDOWN" & @LF) Case $LLKHF_EXTENDED ConsoleWrite("$LLKHF_EXTENDED" & @LF) Case $LLKHF_INJECTED ConsoleWrite("$LLKHF_INJECTED" & @LF) Case $LLKHF_UP ConsoleWrite("$LLKHF_UP: scanCode - " & DllStructGetData($tKEYHOOKS, "scanCode") & @TAB & "vkCode - " & DllStructGetData($tKEYHOOKS, "vkCode") & @LF) EndSwitch EndIf Return _WinAPI_CallNextHookEx($hHook, $nCode, $wParam, $lParam) EndFunc ;==>_KeyProc Func OnAutoItExit() _WinAPI_UnhookWindowsHookEx($hHook) DllCallbackFree($hStub_KeyProc) EndFunc ;==>OnAutoItExit Edited July 5, 2009 by wolf9228 صرح السماء كان هنا Link to comment Share on other sites More sharing options...
Miranda Posted July 5, 2009 Author Share Posted July 5, 2009 (edited) Am I supposed to understand your code or just run it? [insert blush emoticon here] Edit: Just ran it, and it definately works, but damn that looks complicated! @ getting that into my script, but thanks a truckload for the solution! Edited July 5, 2009 by Miranda Link to comment Share on other sites More sharing options...
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