See start for instructions / features
You need a transparent GIF to use as the crosshair image. Default size is 9x9 but you can use any size...
; Generic crosshair overlay v1.0 ; By [email protected] ; Instructions: ; ============= ; Will ONLY work in WINDOWED mode ; 1) Run app to overlay crosshair to and make it active ; 2) Hit WIN+Insert to designate that as app to overlay to ; 3) Crosshair will appear but probably in wrong place ; 4) Use WIN+Arrow keys to move crosshair to right place ; Crosshair will ONLY appear while designated app is active ; Settings saved to INI file so you only have to set up once ; This is NOT a hack, it merely creates a transparent window ; that has "Always on top" property set ; Custom crosshairs can be used, edit ch.gif and edit size vars below ch_x = 9 ; X size of ch.gif ch_y = 9 ; Y size of ch.gif ; DO NOT EDIT BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING! ; ========================================================== ; Remove .ahk and .exe from filename to get name for INI file ScriptName := A_ScriptName StringReplace, ScriptName, ScriptName, .ahk,, All StringReplace, ScriptName, ScriptName, .exe,, All ; Find position of window on screen WinGetPos, winx, winy, winw, winh, ahk_class %progclass% ; PosX and PosY hold offset of cursor within window (From centre) PosX := 0 PosY := 0 ; Read vals from INI file IniRead, PosX, %ScriptName%.ini, Main, PosX, %PosX% IniRead, PosY, %ScriptName%.ini, Main, PosY, %PosY% IniRead, progclass, %ScriptName%.ini, Main, progclass, %progclass% ; Calculate offsets GoSub, offsetch ; Init overlay Gui, Add, Picture, w%ch_x% h%ch_y% AltSubmit, ch.gif Gui, Color, FFFFFF GoSub, showch Gui +AlwaysOnTop WinSet, TransColor, White, %A_ScriptName% Gui -Caption +ToolWindow ; Hide overlay GoSub, hidech ; MAIN LOOP SetTimer, tick, 500 ; ================================================================================ ; HOTKEYS #Up:: PosY -= 1 GoSub, showch IniWrite, %PosY%, %ScriptName%.ini, Main, PosY return #Down:: PosY += 1 GoSub, showch IniWrite, %PosY%, %ScriptName%.ini, Main, PosY return #Left:: PosX -= 1 GoSub, showch IniWrite, %PosX%, %ScriptName%.ini, Main, PosX return #Right:: PosX += 1 GoSub, showch IniWrite, %PosX%, %ScriptName%.ini, Main, PosX return #Insert:: WinGetActiveTitle, wint WinGetClass, progclass, %wint% IniWrite, %progclass%, %ScriptName%.ini, Main, progclass return ; Shows the crosshair showch: GoSub, offsetch Gui, Show, NA x%chx% y%chy% return ; Hides the crosshair hidech: Gui, Cancel return ; Calculate offset offsetch: chx := winx + (winw /2) + PosX chy := winy + (winh /2) + PosY return tick: IfWinActive, ahk_class %progclass% { ; Check to see if window moved WinGetPos, winx, winy, winw, winh, ahk_class %progclass% ; Draw crosshair GoSub, showch } else { GoSub, hidech } return