skew Posted August 31, 2011 Share Posted August 31, 2011 I'm using a Logitech K350 keyboard. On the left hand side of the keyboard, there are two buttons to zoom in or to zoom out. It is similar to CTRL + mouse wheel in Firefox. I wanna map these two keys. How do I do that? Is there a tool to record key codes by pressing them? Link to comment Share on other sites More sharing options...
sleepydvdr Posted August 31, 2011 Share Posted August 31, 2011 I had the exact same question today. I have a Lenovo keyboard that has a calculator button that doesn't pull up the calculator when I press it. Here's something that I found that helped me: However, the calculator key I wanted to re-map did not show up. I guess it's non-standard and AutoIt could not recognize it. AutoIt recognized all other keys. Good luck! #include <ByteMe.au3> Link to comment Share on other sites More sharing options...
monoscout999 Posted August 31, 2011 Share Posted August 31, 2011 Did you try the _WinAPI_IsPressed Function example that comes with the WinAPIEx UDF? Link to comment Share on other sites More sharing options...
skew Posted August 31, 2011 Author Share Posted August 31, 2011 In the link which you have posted, an example is given. I've tested it. It displays me the shift key while I press the zoom in/out key. Strange. How exactly do you have solved your problem? Link to comment Share on other sites More sharing options...
monoscout999 Posted August 31, 2011 Share Posted August 31, 2011 In the link which you have posted, an example is given. I've tested it. It displays me the shift key while I press the zoom in/out key. Strange. How exactly do you have solved your problem? Did you try the _WinAPI_IsPressed Function example that comes with the WinAPIEx UDF? Link to comment Share on other sites More sharing options...
skew Posted September 1, 2011 Author Share Posted September 1, 2011 Yeah. Link to comment Share on other sites More sharing options...
monoscout999 Posted September 1, 2011 Share Posted September 1, 2011 (edited) Yeah. And The result is? .... expandcollapse popupOpt('GUICloseOnESC', 0) Opt('MustDeclareVars', 1) Global $Label, $Key, $Prev = Default GUICreate('MyGUI', 200, 200) $Label = GUICtrlCreateLabel('', 10, 59, 180, 82, 0x01) GUICtrlSetFont(-1, 48, 400, 0, 'Tahoma') GUISetState() While 1 Sleep(10) If GUIGetMsg() = -3 Then ExitLoop EndIf $Key = 0 $Key = _WinAPI_IsPressed(0x00, 0xFF) If $Key <> $Prev Then GUICtrlSetData($Label, '0x' & Hex($Key, 2)) $Prev = $Key EndIf WEnd Func _WinAPI_IsPressed($iFrom = 0x01, $iTo = 0xFF) Local $tData = _WinAPI_GetKeyboardState() If @error Then Return SetError(1, 0, 0) EndIf For $i = $iFrom To $iTo Switch $i Case 0x0A, 0x0B, 0x0E To 0x0F, 0x16, 0x1A, 0x1C To 0x1F, 0x3A To 0x40, 0x5E, 0x88 To 0x8F, 0x97 To 0x9F, 0xB8 To 0xB9, 0xC1 To 0xDA, 0xE0, 0xE8 ContinueLoop Case Else If BitAND(DllStructGetData($tData, 1, $i + 1), 0xF0) Then Return $i EndIf EndSwitch Next Return 0 EndFunc ;==>_WinAPI_IsPressed Func _WinAPI_GetKeyboardState() Local $tData = DllStructCreate('byte[256]') Local $Ret = DllCall('user32.dll', 'int', 'GetKeyboardState', 'ptr', DllStructGetPtr($tData)) If (@error) Or (Not $Ret[0]) Then Return SetError(1, 0, 0) EndIf Return $tData EndFunc ;==>_WinAPI_GetKeyboardState Edited September 1, 2011 by monoscout999 Link to comment Share on other sites More sharing options...
skew Posted September 2, 2011 Author Share Posted September 2, 2011 Nothing changes while I'm pressing the zoom in/out key. So the result is 0x00. 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