Programming a "Sniper" button
Posted: 2013-05-31 00:24
I recently got the Gigabyte GM-M6880 mouse off of NCIX, and I'm satisfied with its performance per dollar ($25). It's got a 3 stage DPI adjustment button as well as two forward and back buttons. However, I'm trying to program one of the buttons on the sides to act as a "sniper" button, which is basically a button that decreases your sensitivity whenever it is held down. The software that is included with the mouse doesn't support this feature at the moment.
I've searched other websites for tips on how to do this, and ended up making it work with an AutoHotKey script. The only problem is that the button only works when I'm browsing the internet or using Windows Explorer. Whenever I start a game, whether it be PR, GTA:SA, Company of Heroes, etc. the button does not work any more.
Does anyone know why this is happening? Is this is a intended effect to prevent hacking, or a software/programming error on my part?
This is my mouse AHK configuration:
I've searched other websites for tips on how to do this, and ended up making it work with an AutoHotKey script. The only problem is that the button only works when I'm browsing the internet or using Windows Explorer. Whenever I start a game, whether it be PR, GTA:SA, Company of Heroes, etc. the button does not work any more.
Does anyone know why this is happening? Is this is a intended effect to prevent hacking, or a software/programming error on my part?
This is my mouse AHK configuration:
;
; AutoHotkey Version: 1.x
; Language: English
; Platform: Win9x/NT
; Author: A.N.Other <[email protected]>
;
; Script Function:
; Template script (you can customize this template by editing "ShellNew\Template.ahk" in your Windows folder)
;
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#InstallMouseHook
#Persistent
SPI_GetMouseSpeed:= 0x70
SPI_SetMouseSpeed:= 0x71
DesiredMouseSpeed:= 3 ; use 1 to 20, default is 10
XButton2::
DllCall("SystemParametersInfo", UInt, SPI_GetMouseSpeed, UInt, 0, UIntP, OrigMouseSpeed, UInt, 0)
DllCall("SystemParametersInfo", UInt, SPI_SetMouseSpeed, UInt, 0, UInt, DesiredMouseSpeed, UInt, 0)
DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, UInt, OrigMouseSpeed, UInt, 0)
Return