lolp1 Posted September 23, 2006 Share Posted September 23, 2006 I've seen one or two auto-it programs that draw a cross hair to the screen (Much like a Counter-strike cross hair) How are they doing this, I researched a bit and couldent find any dirt on it:D. Link to comment Share on other sites More sharing options...
cppman Posted September 23, 2006 Share Posted September 23, 2006 just a few posts down from this one is a perfect example: from DarkShadow expandcollapse popup#Include <Misc.au3> #NoTrayIcon HotKeySet("{PGUP}","TogXHair") HotKeySet("{END}","Exitt") Opt("ColorMode",0) Global $dc Global $x Global $y Global $on Global $color Global $dll Global $xhclr Global $on Global $off $on = 1 $off = 0 $xhclr = 0x0000FF ;$xhclr = "0xFF9986" $dll = DllOpen("user32.dll") MsgBox(0,"Simple Xhair","Welcome to Simple Xhair." & @LF & "" & @LF & "PGUP: Toggle XHair On/Off" & @LF & "END: Exit" & @LF & "" & @LF & "" & @LF & "Made by DarkShadow" & @LF & "www.vacdisabled.net" & @LF & "www.ddcodingcrew.com") While 1 If $on = 1 Then DrawXHair() ElseIf $on = 0 Then NoXHair() EndIf ;Sleep(5) WEnd #region; funcs Func drawpix($dc,$x,$y,$color) DllCall ("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $x, "long", $y, "long", $color) EndFunc Func DrawXHair() While 1 pict1(@DesktopWidth / 2,@DesktopHeight / 2) Sleep(50) WEnd EndFunc Func swap(ByRef $a, ByRef $B) Local $t $t = $a $a = $b $b = $t EndFunc Func TogXHair() swap($on, $off) EndFunc Func NoXHair() While 1 Sleep(1000) WEnd EndFunc Func Exitt() MsgBox(0,"Simple Xhair","Made by DarkShadow. Please visit www.VACDisabled.net and www.DDCodingCrew.com") Sleep(500) Exit EndFunc Func pict1($x,$y) $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") While 1 ;drawpix($dc,$x+1,$y,$xhclr) drawpix($dc,$x+2,$y,$xhclr) drawpix($dc,$x+3,$y,$xhclr) drawpix($dc,$x+4,$y,$xhclr) drawpix($dc,$x+5,$y,$xhclr) ;drawpix($dc,$x-1,$y,$xhclr) drawpix($dc,$x-2,$y,$xhclr) drawpix($dc,$x-3,$y,$xhclr) drawpix($dc,$x-4,$y,$xhclr) drawpix($dc,$x-5,$y,$xhclr) ;drawpix($dc,$x,$y+1,$xhclr) drawpix($dc,$x,$y+2,$xhclr) drawpix($dc,$x,$y+3,$xhclr) drawpix($dc,$x,$y+4,$xhclr) drawpix($dc,$x,$y+5,$xhclr) ;drawpix($dc,$x,$y-1,$xhclr) drawpix($dc,$x,$y-2,$xhclr) drawpix($dc,$x,$y-3,$xhclr) drawpix($dc,$x,$y-4,$xhclr) drawpix($dc,$x,$y-5,$xhclr) ;this is the plus ^^^ WEnd DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) EndFunc #endregion;end funcs hope this helps you.. Miva OS Project Link to comment Share on other sites More sharing options...
lolp1 Posted September 23, 2006 Author Share Posted September 23, 2006 just a few posts down from this one is a perfect example: from DarkShadow expandcollapse popup#Include <Misc.au3> #NoTrayIcon HotKeySet("{PGUP}","TogXHair") HotKeySet("{END}","Exitt") Opt("ColorMode",0) Global $dc Global $x Global $y Global $on Global $color Global $dll Global $xhclr Global $on Global $off $on = 1 $off = 0 $xhclr = 0x0000FF ;$xhclr = "0xFF9986" $dll = DllOpen("user32.dll") MsgBox(0,"Simple Xhair","Welcome to Simple Xhair." & @LF & "" & @LF & "PGUP: Toggle XHair On/Off" & @LF & "END: Exit" & @LF & "" & @LF & "" & @LF & "Made by DarkShadow" & @LF & "www.vacdisabled.net" & @LF & "www.ddcodingcrew.com") While 1 If $on = 1 Then DrawXHair() ElseIf $on = 0 Then NoXHair() EndIf ;Sleep(5) WEnd #region; funcs Func drawpix($dc,$x,$y,$color) DllCall ("gdi32.dll", "long", "SetPixel", "long", $dc[0], "long", $x, "long", $y, "long", $color) EndFunc Func DrawXHair() While 1 pict1(@DesktopWidth / 2,@DesktopHeight / 2) Sleep(50) WEnd EndFunc Func swap(ByRef $a, ByRef $B) Local $t $t = $a $a = $b $b = $t EndFunc Func TogXHair() swap($on, $off) EndFunc Func NoXHair() While 1 Sleep(1000) WEnd EndFunc Func Exitt() MsgBox(0,"Simple Xhair","Made by DarkShadow. Please visit www.VACDisabled.net and www.DDCodingCrew.com") Sleep(500) Exit EndFunc Func pict1($x,$y) $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") While 1 ;drawpix($dc,$x+1,$y,$xhclr) drawpix($dc,$x+2,$y,$xhclr) drawpix($dc,$x+3,$y,$xhclr) drawpix($dc,$x+4,$y,$xhclr) drawpix($dc,$x+5,$y,$xhclr) ;drawpix($dc,$x-1,$y,$xhclr) drawpix($dc,$x-2,$y,$xhclr) drawpix($dc,$x-3,$y,$xhclr) drawpix($dc,$x-4,$y,$xhclr) drawpix($dc,$x-5,$y,$xhclr) ;drawpix($dc,$x,$y+1,$xhclr) drawpix($dc,$x,$y+2,$xhclr) drawpix($dc,$x,$y+3,$xhclr) drawpix($dc,$x,$y+4,$xhclr) drawpix($dc,$x,$y+5,$xhclr) ;drawpix($dc,$x,$y-1,$xhclr) drawpix($dc,$x,$y-2,$xhclr) drawpix($dc,$x,$y-3,$xhclr) drawpix($dc,$x,$y-4,$xhclr) drawpix($dc,$x,$y-5,$xhclr) ;this is the plus ^^^ WEnd DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) EndFunc #endregion;end funcs hope this helps you.. His was the one I was refering to, but this is amazingly simple, and I've known how to do this. Was looking for something alot more complex. Link to comment Share on other sites More sharing options...
Zedna Posted September 23, 2006 Share Posted September 23, 2006 Try to use MoveTo/LineTo API instead of SetPixelLook for example at my radar project. It's in my signature. Resources UDF Â ResourcesEx UDF Â AutoIt Forum Search Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 23, 2006 Moderators Share Posted September 23, 2006 His was the one I was refering to, but this is amazingly simple, and I've known how to do this. Was looking for something alot more complex.Doubtful Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
darkshadow791 Posted September 23, 2006 Share Posted September 23, 2006 (edited) lolp1 you could've asked me yourself How exactly do you want it to be complex? You can do a lot if you put your mind to it using that base. (Using fractions based off of a screen's resolution, converting it, etc. - that's what's going to go into my next release) Edited September 23, 2006 by darkshadow791 Note Taker Lite - a note taking / converting tool. Link to comment Share on other sites More sharing options...
lolp1 Posted September 24, 2006 Author Share Posted September 24, 2006 (edited) I've already set my mind, and put my project to work... you'll probably see it on the forums some time soon. Your missing key things, such as only applying the cross hair to key screens, EG: it only shows on certian game screens, as well as checks game screen size to make sure it's in the ceneter. Edited September 24, 2006 by lolp1 Link to comment Share on other sites More sharing options...
darkshadow791 Posted September 24, 2006 Share Posted September 24, 2006 Center for all resolutions will be supported for my next version and showing only in game will be for the version after that along with a better shape... Note Taker Lite - a note taking / converting tool. Link to comment Share on other sites More sharing options...
Dolemite50 Posted March 26, 2007 Share Posted March 26, 2007 DoubtfulIt's rare that I actually LOL on the computer, let alone on a coding forum,...but maannnnn...that really caught me off guard. 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