JoHanatCent Posted December 21, 2010 Posted December 21, 2010 Created because: * Wanted to see if I can * Can I use percentadges to control size? * Visualization of the Random function * Wanted to see if this can waist other peoples time as well * See some reaction from other users. expandcollapse popup;================================= * = * = * = * = * = * =========================================================== #NoTrayIcon SRandom(@AutoItPID) WinMinimizeAll () HotKeySet("{ESC}", "OntSnap"); == * * * == To stop the program $lengte = 450 Dim $x0ne, $yone, $xtwo, $ytwo, $line, $Slaap, $LineColor, $LineWidth While "Creating the Stars" $Slaap = Random(1, 1000, 1) $lengte = Random(50, 450, 1) $LineWidth = Random(2, 20, 1) $x0ne = Random(10, @DesktopWidth - $lengte / 3, 1) Sleep($Slaap) $yone = Random(-1, @DesktopHeight - $lengte / 3, 1) $xtwo = $x0ne + $lengte * .328 $ytwo = $yone + $lengte * .955 $LineColor = Random(0x000000, 0xFFFFFF, 1) DrawALine() $x0ne = $x0ne - $lengte * .507 $yone = $yone + $lengte * .373 Sleep($Slaap) DrawALine() $xtwo = $xtwo + $lengte * .164 $ytwo = $ytwo - $lengte * .582 Sleep($Slaap) DrawALine() $x0ne = $x0ne + $lengte * .179 $yone = $yone + $lengte * .582 Sleep($Slaap) DrawALine() $xtwo = $xtwo - $lengte * .492 $ytwo = $ytwo - $lengte * .373 Sleep($Slaap) DrawALine() Sleep($Slaap) WEnd Func DrawALine() $hnd = DllCall("user32.dll", "int", "GetDC", "hwnd", 0) $pen = DllCall("gdi32.dll", "int", "CreatePen", "int", 0, "int", $LineWidth, "int", $LineColor) DllCall("gdi32.dll", "int", "SelectObject", "int", $hnd[0], "int", $pen[0]) DllCall("GDI32.dll", "int", "MoveToEx", "hwnd", $hnd[0], "int", $x0ne, "int", $yone, "int", 0) DllCall("GDI32.dll", "int", "LineTo", "hwnd", $hnd[0], "int", $xtwo, "int", $ytwo) DllCall("user32.dll", "int", "ReleaseDC", "hwnd", 0, "int", $hnd[0]) EndFunc ;==>DrawALine Func OntSnap() WinMinimizeAllUndo ( ) Exit EndFunc ;==>OntSnap ;================================= * = * = * = * = * = * ===========================================================
wakillon Posted December 21, 2010 Posted December 21, 2010 It's funny ! That's a lot of beautiful stars for the holidays of year-end ! Thanks. AutoIt 3.3.18.0 X86 - SciTE 4.4.6.0 - WIN 11 24H2 X64 - Other Examples Scripts
JoHanatCent Posted December 22, 2010 Author Posted December 22, 2010 @wakillon - You are welcome. @least I could bring joy to one person this year.
firecloud Posted December 23, 2010 Posted December 23, 2010 Thanks. For me, it's a quite good example to start learning "DllCall" & "DC".
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