darkshadow791 Posted September 22, 2006 Share Posted September 22, 2006 Credit's aren't put in yet but they will be so don't get mad at me for that... It works fine so far but it won't turn off or toggle... I plan on adding different shapes but here is the base code at the moment... 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 Note Taker Lite - a note taking / converting tool. Link to comment Share on other sites More sharing options...
cppman Posted September 22, 2006 Share Posted September 22, 2006 (edited) here ya go! This probably is'nt the most efficient way of doing it... but it works. lol (considering it uses 100% CPU)Fixed the 100% cpu usage problem 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 Global $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") $on = True $off = False $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 == True Then DrawXHair() ElseIf $on == False Then ;Do Nothing ;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) if ($a == false) then $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") Local $t $t = $a $a = $b $b = $t EndFunc Func TogXHair() DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) Run("rundll32 user32.dll,UpdatePerUserSystemParameters") swap($on, $off) EndFunc Func NoXHair() While 1 Sleep(1000) WEnd EndFunc Func Exitt() ;ProcessClose("explorer.exe") Run("rundll32 user32.dll,UpdatePerUserSystemParameters") MsgBox(0,"Simple Xhair","Made by DarkShadow. Please visit www.VACDisabled.net and www.DDCodingCrew.com") Sleep(500) Exit EndFunc Func pict1($x,$y) ;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 ^^^ ;DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) EndFunc #endregion;end funcs Edited September 22, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
darkshadow791 Posted September 23, 2006 Author Share Posted September 23, 2006 Thanks I was wondering if you may post a version of it (since I'm not completely sure of what you did) that would allow toggling of multiple xhairs (via pgup, toggles through a number of different xhairs as opposed to being on or off...) Note Taker Lite - a note taking / converting tool. Link to comment Share on other sites More sharing options...
darkshadow791 Posted September 23, 2006 Author Share Posted September 23, 2006 As in drawing different shapes (different "pict#'s") As in: Default: pict1() hit pgup: pict2() etc and pict2() would be like pict1() only instead of a plus i would make an "X" or whatever shape I desire. - ty for your help Note Taker Lite - a note taking / converting tool. Link to comment Share on other sites More sharing options...
cppman Posted September 23, 2006 Share Posted September 23, 2006 (edited) toggles between crosshairs and rectangle:for drawing other shapes with GDI.. check this out: http://windowssdk.msdn.microsoft.com/en-us...y/ms533282.aspxexpandcollapse popup#Include <Misc.au3> #NoTrayIcon HotKeySet("{PGUP}","TogXHair") HotKeySet("{END}","Exitt") Opt("ColorMode",0) Global $dc Global $x = @DesktopWidth/2 Global $y = @DesktopHeight/2 Global $color Global $dll Global $xhclr Global $on Global $off Global $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") $on = True $off = False $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 == True Then DrawXHair() ElseIf $on == False Then ;Do Nothing ;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($x,$y) Sleep(50) WEnd EndFunc Func swap(ByRef $a, ByRef $B) if ($a == false or $a == True) then $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") Local $t $t = $a $a = $b $b = $t EndFunc Func TogXHair() DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) Run("rundll32 user32.dll,UpdatePerUserSystemParameters") swap($on, $off) EndFunc Func NoXHair() While 1 Sleep(1000) WEnd EndFunc Func Exitt() ;ProcessClose("explorer.exe") Run("rundll32 user32.dll,UpdatePerUserSystemParameters") MsgBox(0,"Simple Xhair","Made by DarkShadow. Please visit www.VACDisabled.net and www.DDCodingCrew.com") Sleep(500) Exit EndFunc Func pict1($x,$y) ;To help you find it easier if ($on == true) Then ;draw this shape ;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 ^^^ Else ;Draw This Shape! DLLCall("gdi32.dll", "none", "Rectangle", "long", $DC[0], "int", $x, "int", $y, "int", $x+25, "int", $y+25) ;DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) EndIf EndFunc #endregion;end funcsis that what you were looking for? Edited September 23, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
darkshadow791 Posted September 23, 2006 Author Share Posted September 23, 2006 (edited) So if I were to have more then two things should I set $on to be a number instead of 0/1 and instead of swapping $on and $off have it increment to the number of shapes I have then reset? Like: expandcollapse popup#Include <Misc.au3> #NoTrayIcon HotKeySet("{PGUP}","TogXHair") HotKeySet("{END}","Exitt") Opt("ColorMode",0) Global $dc Global $x = @DesktopWidth/2 Global $y = @DesktopHeight/2 Global $color Global $dll Global $xhclr Global $on Global $off Global $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") $on = True $off = False $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 == True Then DrawXHair() ElseIf $on == False Then ;Do Nothing ;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($x,$y) Sleep(50) WEnd EndFunc Func swap(ByRef $a, ByRef $B) if ($a == false or $a == True) then $dc= DllCall ("user32.dll", "int", "GetDC", "hwnd", "") Local $t $t = $a $a = $b $b = $t EndFunc Func TogXHair() DllCall ("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $dc[0]) Run("rundll32 user32.dll,UpdatePerUserSystemParameters") ;swap($on, $off) If $on >= 3 Then $on = $on + 1 Else $on = 1 EndIf EndFunc Func NoXHair() While 1 Sleep(1000) WEnd EndFunc Func Exitt() ;ProcessClose("explorer.exe") Run("rundll32 user32.dll,UpdatePerUserSystemParameters") MsgBox(0,"Simple Xhair","Made by DarkShadow. Please visit www.VACDisabled.net and www.DDCodingCrew.com") Sleep(500) Exit EndFunc Func pict1($x,$y) ;To help you find it easier If $on = 1 Then ;draw this shape ;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 ^^^ ElseIf $on = 2 Then ;Draw This Shape! ;DLLCall("gdi32.dll", "none", "Rectangle", "long", $DC[0], "int", $x-15, "int", $y-15, "int", $x+15, "int", $y+15) drawpix($dc,$x+2,$y+2,$xhclr) drawpix($dc,$x+3,$y+3,$xhclr) drawpix($dc,$x+4,$y+4,$xhclr) drawpix($dc,$x+5,$y+5,$xhclr) ;drawpix($dc,$x-1,$y,$xhclr) drawpix($dc,$x-2,$y-2,$xhclr) drawpix($dc,$x-3,$y-3,$xhclr) drawpix($dc,$x-4,$y-4,$xhclr) drawpix($dc,$x-5,$y-5,$xhclr) ;drawpix($dc,$x,$y+1,$xhclr) drawpix($dc,$x+2,$y-2,$xhclr) drawpix($dc,$x+3,$y-3,$xhclr) drawpix($dc,$x+4,$y-4,$xhclr) drawpix($dc,$x+5,$y-5,$xhclr) ;drawpix($dc,$x,$y-1,$xhclr) drawpix($dc,$x-2,$y+2,$xhclr) drawpix($dc,$x-3,$y+3,$xhclr) drawpix($dc,$x-4,$y+4,$xhclr) drawpix($dc,$x-5,$y+5,$xhclr) ; ;drawpix($dc,$x+2,$y+2,$xhclr) ElseIf $on = 3 Then drawpix($dc,$x+2,$y+2,$xhclr) drawpix($dc,$x+3,$y+3,$xhclr) drawpix($dc,$x+4,$y+4,$xhclr) drawpix($dc,$x+5,$y+5,$xhclr) drawpix($dc,$x-2,$y-2,$xhclr) drawpix($dc,$x-3,$y-3,$xhclr) drawpix($dc,$x-4,$y-4,$xhclr) drawpix($dc,$x-5,$y-5,$xhclr) drawpix($dc,$x+2,$y-2,$xhclr) drawpix($dc,$x+3,$y-3,$xhclr) drawpix($dc,$x+4,$y-4,$xhclr) drawpix($dc,$x+5,$y-5,$xhclr) drawpix($dc,$x-2,$y+2,$xhclr) drawpix($dc,$x-3,$y+3,$xhclr) drawpix($dc,$x-4,$y+4,$xhclr) drawpix($dc,$x-5,$y+5,$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-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+2,$xhclr) drawpix($dc,$x,$y+3,$xhclr) drawpix($dc,$x,$y+4,$xhclr) drawpix($dc,$x,$y+5,$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) EndIf EndFunc #endregion;end funcs (This doesn't work and I'm not sure why... would you mind explaining it?) Edited September 23, 2006 by darkshadow791 Note Taker Lite - a note taking / converting tool. Link to comment Share on other sites More sharing options...
cppman Posted September 23, 2006 Share Posted September 23, 2006 (edited) yep Edited September 23, 2006 by CHRIS95219 Miva OS Project Link to comment Share on other sites More sharing options...
darkshadow791 Posted September 23, 2006 Author Share Posted September 23, 2006 (edited) Yet that script doesn't work (bottom of previous post) and I'm not sure why... Edited September 23, 2006 by darkshadow791 Note Taker Lite - a note taking / converting tool. Link to comment Share on other sites More sharing options...
cppman Posted September 23, 2006 Share Posted September 23, 2006 hmm, i can't figure out why ... Miva OS Project Link to comment Share on other sites More sharing options...
darkshadow791 Posted September 23, 2006 Author Share Posted September 23, 2006 anyone else have any ideas? Note Taker Lite - a note taking / converting tool. 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