corgano Posted August 26, 2009 Share Posted August 26, 2009 (edited) I saw an autoit screensaver on here and there was something similar to this in it, I decided it might be fun to try one myself. Enjoy *NEW VERSION* now in GDI+ and has export. expandcollapse popup#include <GUIConstantsEx.au3> #include <GDIPLus.au3> #include <WinAPI.au3> #include <ScreenCapture.au3> Global $gui, $pic, $s1, $s2, $s3, $s4, $s5, $b1, $c1, $msg, $show $gui = GUICreate("GDI+ Circles", 800, 600) $pic = GUICtrlCreatePic("", 0, 0, 600, 600) GUICtrlCreateLabel("Size", 630, 35) $s1 = GUICtrlCreateSlider(600, 50, 200, 50);len GUICtrlSetLimit(-1, 290, 1) GUICtrlSetData(-1, 150) GUICtrlCreateLabel("Num of peaks", 630, 135) $s2 = GUICtrlCreateSlider(600, 150, 200, 50);peaks GUICtrlSetLimit(-1, 10, 2) GUICtrlSetData(-1, 2) GUICtrlCreateLabel("# of lines", 630, 235) $s3 = GUICtrlCreateSlider(600, 250, 200, 50);dist GUICtrlSetLimit(-1, 360, 10) GUICtrlSetData(-1, 100) GUICtrlCreateLabel("Inatial rotation", 630, 335) $s4 = GUICtrlCreateSlider(600, 350, 200, 50);add GUICtrlSetLimit(-1, 7, 0) GUICtrlSetData(-1, 2) GUICtrlCreateLabel("Draw Speed", 630, 435) $s5 = GUICtrlCreateSlider(600, 450, 200, 50);speed GUICtrlSetLimit(-1, 50, 0) GUICtrlSetData(-1, 30) GUISetState() $b1 = GUICtrlCreateButton("Export",630,500,100,30) $c1 = GUICtrlCreateCheckbox("Don't show drawing",630,535,150,20) $c2 = GUICtrlCreateCheckbox("crop export",630,555,150,20) refreash() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $s1, $s2, $s3, $s4, $s5, $c1 refreash() Case $b1 $name = InputBox("Export","Please enter image name, ex: cool awesome",Round(Random(1,9999999))) $pos = WinGetPos("GDI+ Circles") $len = GUICtrlRead($s1) WinActivate("GDI+ Circles") If GUICtrlRead($c2) = true Then _ScreenCapture_Capture($name & ".jpg", $pos[0]+ 293 - $len, $pos[1]+ 314 - $len, $pos[0] + 313 + $len, $pos[1] + 334 + $len, False) Else _ScreenCapture_Capture($name & ".jpg", $pos[0]+3, $pos[1]+24, $pos[0] + 603, $pos[1] + 604, False) EndIf EndSwitch WEnd Func refreash() Local $len, $dist, $peaks, $add, $speed, $show = True $len = GUICtrlRead($s1) $dist = (360 / GUICtrlRead($s3)) $peaks = GUICtrlRead($s2) $add = GUICtrlRead($s4) $speed = 50 - GUICtrlRead($s5) If GUICtrlRead($c1) = $GUI_CHECKED Then $show = False fracircle($pic, $dist, $len, $peaks, $add, $speed, $show) EndFunc ;==>refreash Func fracircle($ctrl, $step, $len, $m = 2, $add = 3, $speed = 10, $show = True) Local $hBmp, $hPen, $hBitmap1, $hGraphic, $hBitmap2, $OldBmp, $one, $two $hBmp = _WinAPI_CreateBitmap(600, 600, 1, 32) _GDIPlus_Startup() $hPen = _GDIPlus_PenCreate(0xFFFFFFFF) $hBitmap1 = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap1) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) For $deg = 0 To 360 Step $step $one = angle(300, 300, $deg + ($add * 45), $len) $two = angle(300, 300, $deg * $m + ($add * 45), $len) _GDIPlus_GraphicsDrawLine($hGraphic, $one[0], $one[1], $two[0], $two[1], $hPen) If $show = true Then $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) $OldBmp = GUICtrlSendMsg($ctrl, 0x0172, 0, $hBitmap2) If $OldBmp Then _WinAPI_DeleteObject($OldBmp) _WinAPI_DeleteObject($hBitmap2) Sleep($speed) EndIf Next If $show = False Then $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) $OldBmp = GUICtrlSendMsg($ctrl, 0x0172, 0, $hBitmap2) If $OldBmp Then _WinAPI_DeleteObject($OldBmp) _WinAPI_DeleteObject($hBitmap2) EndIf _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap1) _GDIPlus_PenDispose($hPen) _GDIPlus_Shutdown() _WinAPI_DeleteObject($hBmp) EndFunc ;==>fracircle Func Angle($x1, $y1, $Ang, $Length, $round = 0) If $Ang >= 360 Then $Ang -= 360 Local $Return[2] $Return[0] = $x1 + ($Length * Cos($Ang / 180 * 3.14159265358979)) $Return[1] = $y1 - ($Length * Sin($Ang / 180 * 3.14159265358979)) If $round = 1 Then $Return[0] = Round($Return[0]) $Return[1] = Round($Return[1]) EndIf Return $Return EndFunc ;==>Angle Edit~added labels Edit~now in GDI+ (thanks smashly). re-added the "do not show drawing" option. Added export button and option to crop exported images. Edited August 28, 2009 by corgano 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
DW1 Posted August 26, 2009 Share Posted August 26, 2009 Hey pretty cool man, thanks for sharing >_< Would be even cooler if you labeled the sliders. AutoIt3 Online Help Link to comment Share on other sites More sharing options...
UEZ Posted August 27, 2009 Share Posted August 27, 2009 (edited) Very nice corgano >_< The settings box on the right side is flickering during the draw. If you can fix it it would be much smoother, e.g. using GDI+ Regards, UEZ Edited August 27, 2009 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
corgano Posted August 27, 2009 Author Share Posted August 27, 2009 Could you post an example? I looked at the help file and couldnt get it to work 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
UEZ Posted August 27, 2009 Share Posted August 27, 2009 (edited) Could you post an example? I looked at the help file and couldnt get it to workJust look in my signature for the screensaver! I published also the source code for it which is included now in the download package (it is unfinished and my 1st steps in GDI+, so don't blame me )UEZ Edited August 27, 2009 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
Info Posted August 27, 2009 Share Posted August 27, 2009 Windows XP SP3, I got the BSOD after I closed the GUI. Link to comment Share on other sites More sharing options...
corgano Posted August 27, 2009 Author Share Posted August 27, 2009 Thats not related to this script. Does nothing but close when you push exit. 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
smashly Posted August 28, 2009 Share Posted August 28, 2009 (edited) Hi, Thank you for sharing, great job corgano. Since you did the maths I did the gdi part of it expandcollapse popup#include <GUIConstantsEx.au3> #include <GDIPLus.au3> #include <WinAPI.au3> Opt("MustDeclareVars", 1) Global $gui, $pic, $s1, $s2, $s3, $s4, $s5, $msg $gui = GUICreate("GDI+", 800, 600) $pic = GUICtrlCreatePic("", 0, 0, 600, 600) GUICtrlCreateLabel("Size", 630, 35) $s1 = GUICtrlCreateSlider(600, 50, 200, 50);len GUICtrlSetLimit(-1, 300, 1) GUICtrlSetData(-1, 150) GUICtrlCreateLabel("Num of peaks", 630, 135) $s2 = GUICtrlCreateSlider(600, 150, 200, 50);peaks GUICtrlSetLimit(-1, 10, 2) GUICtrlSetData(-1, 2) GUICtrlCreateLabel("# of lines", 630, 235) $s3 = GUICtrlCreateSlider(600, 250, 200, 50);dist GUICtrlSetLimit(-1, 360, 10) GUICtrlSetData(-1, 100) GUICtrlCreateLabel("Inatial rotation", 630, 335) $s4 = GUICtrlCreateSlider(600, 350, 200, 50);add GUICtrlSetLimit(-1, 7, 0) GUICtrlSetData(-1, 2) GUICtrlCreateLabel("Draw Speed", 630, 435) $s5 = GUICtrlCreateSlider(600, 450, 200, 50);speed GUICtrlSetLimit(-1, 50, 10) GUICtrlSetData(-1, 30) GUISetState() refreash() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $s1, $s2, $s3, $s4, $s5 refreash() EndSwitch WEnd Func refreash() Local $len, $dist, $peaks, $add, $speed $len = GUICtrlRead($s1) $dist = (360 / GUICtrlRead($s3)) $peaks = GUICtrlRead($s2) $add = GUICtrlRead($s4) $speed = 50 - GUICtrlRead($s5) fracircle($pic, $dist, $len, $peaks, $add, $speed) EndFunc ;==>refreash Func fracircle($ctrl, $step, $len, $m = 2, $add = 3, $speed = 10) Local $hBmp, $hPen, $hBitmap1, $hGraphic, $hBitmap2, $OldBmp, $one, $two $hBmp = _WinAPI_CreateBitmap(600, 600, 1, 32) _GDIPlus_Startup() $hPen = _GDIPlus_PenCreate(0xFFFFFFFF) $hBitmap1 = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap1) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) For $deg = 0 To 360 Step $step $one = angle(300, 300, $deg + ($add * 45), $len) $two = angle(300, 300, $deg * $m + ($add * 45), $len) _GDIPlus_GraphicsDrawLine($hGraphic, $one[0], $one[1], $two[0], $two[1], $hPen) $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) $OldBmp = GUICtrlSendMsg($ctrl, 0x0172, 0, $hBitmap2) If $OldBmp Then _WinAPI_DeleteObject($OldBmp) _WinAPI_DeleteObject($hBitmap2) Sleep($speed) Next _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap1) _GDIPlus_PenDispose($hPen) _GDIPlus_Shutdown() _WinAPI_DeleteObject($hBmp) EndFunc ;==>fracircle Func Angle($x1, $y1, $Ang, $Length, $round = 0) If $Ang >= 360 Then $Ang -= 360 Local $Return[2] $Return[0] = $x1 + ($Length * Cos($Ang / 180 * 3.14159265358979)) $Return[1] = $y1 - ($Length * Sin($Ang / 180 * 3.14159265358979)) If $round = 1 Then $Return[0] = Round($Return[0]) $Return[1] = Round($Return[1]) EndIf Return $Return EndFunc ;==>AngleCheers Edit: Added UEZ'z suggestion from below Edited August 28, 2009 by smashly Link to comment Share on other sites More sharing options...
UEZ Posted August 28, 2009 Share Posted August 28, 2009 If you add _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) to line 64 (between $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap1) and For $deg = 0 To 360 Step $step in function Func fracircle($ctrl, $step, $len, $m = 2, $add = 3, $speed = 10)) in smashly's script, the lines will look much smoother (anti aliasing)!UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
corgano Posted August 28, 2009 Author Share Posted August 28, 2009 Uploading new version, now GDI+ and has export button. 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
IchBistTod Posted August 29, 2009 Share Posted August 29, 2009 I have made some small modifications to make it run as a screensaver. expandcollapse popup#include <GUIConstantsEx.au3> #include <GDIPLus.au3> #include <WinAPI.au3> #include <ScreenCapture.au3> Global $gui, $pic, $s1, $s2, $s3, $s4, $s5, $b1, $c1, $msg, $show HotKeySet("{esc}", "_exit") $gui =GUICreate("GDI+ Circles", @DesktopWidth, @DesktopHeight, 0, 0, 0x80000000, 0x00000008) GUISetBkColor(0x000000) GUISetState() $pic = GUICtrlCreatePic("", 0, 0, @DesktopWidth, @DesktopHeight) ;GUICtrlCreateLabel("Size", 630, 35) ;$s1 = GUICtrlCreateSlider(600, 50, 200, 50);len ;GUICtrlSetLimit(-1, 290, 1) ;GUICtrlSetData(-1, 150) ;GUICtrlCreateLabel("Num of peaks", 630, 135) ;$s2 = GUICtrlCreateSlider(600, 150, 200, 50);peaks ;GUICtrlSetLimit(-1, 10, 2) ;GUICtrlSetData(-1, 2) ;GUICtrlCreateLabel("# of lines", 630, 235) ;$s3 = GUICtrlCreateSlider(600, 250, 200, 50);dist ;GUICtrlSetLimit(-1, 360, 10) ;GUICtrlSetData(-1, 100) ;GUICtrlCreateLabel("Inatial rotation", 630, 335) ;$s4 = GUICtrlCreateSlider(600, 350, 200, 50);add ;GUICtrlSetLimit(-1, 7, 0) ;GUICtrlSetData(-1, 2) ;GUICtrlCreateLabel("Draw Speed", 630, 435) ;$s5 = GUICtrlCreateSlider(600, 450, 200, 50);speed ;GUICtrlSetLimit(-1, 50, 0) ;GUICtrlSetData(-1, 30) GUISetState() ;$b1 = GUICtrlCreateButton("Export",630,500,100,30) ;$c1 = GUICtrlCreateCheckbox("Don't show drawing",630,535,150,20) ;$c2 = GUICtrlCreateCheckbox("crop export",630,555,150,20) $oldcoords = MouseGetPos() while 1 $newcoords = MouseGetPos() if $oldcoords[0] <> $newcoords[0] then Exit if $oldcoords[1] <> $newcoords[1] then Exit refreash() $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit ;Case $s1, $s2, $s3, $s4, $s5, $c1 ; refreash() ;;Case $b1 ; $name = InputBox("Export","Please enter image name, ex: cool awesome",Round(Random(1,9999999))) ; $pos = WinGetPos("GDI+ Circles") ; $len = GUICtrlRead($s1) ; WinActivate("GDI+ Circles") ; If GUICtrlRead($c2) = true Then ; _ScreenCapture_Capture($name & ".jpg", $pos[0]+ 293 - $len, $pos[1]+ 314 - $len, $pos[0] + 313 + $len, $pos[1] + 334 + $len, False) ; Else ; _ScreenCapture_Capture($name & ".jpg", $pos[0]+3, $pos[1]+24, $pos[0] + 603, $pos[1] + 604, False) ; EndIf EndSwitch WEnd Func refreash() Local $len, $dist, $peaks, $add, $speed, $show = True $len = Random(1, 600);GUICtrlRead($s1) $dist = (360 / Random(10, 360)) $peaks = Random(1, 10);GUICtrlRead($s2) $add = Random(1,7);GUICtrlRead($s4) $speed = 50 - Random(1, 50) ;If GUICtrlRead($c1) = $GUI_CHECKED Then $show = False fracircle($pic, $dist, $len, $peaks, $add, $speed, $show) EndFunc ;==>refreash Func fracircle($ctrl, $step, $len, $m = 2, $add = 3, $speed = 10, $show = True) Local $hBmp, $hPen, $hBitmap1, $hGraphic, $hBitmap2, $OldBmp, $one, $two $hBmp = _WinAPI_CreateBitmap(@DesktopWidth,@DesktopHeight, 1, 32) dim $colors[10] $colors[0] = 0xFFFFFFFF $colors[1] = 0xFF00FF00 $colors[2] = 0xFFFF0000 $colors[3] = 0xFF0000FF $colors[4] = 0xFFFF00FF $colors[5] = 0xFF00FFFF $colors[6] = 0xFF0033FF $colors[7] = 0xFFFF5500 $colors[8] = 0xFFFF55FF $colors[9] = 0xFF99FFFF _GDIPlus_Startup() $hPen = _GDIPlus_PenCreate($colors[Random(0,9,1)]) $hBitmap1 = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap1) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) For $deg = 0 To 360 Step $step $newcoords = MouseGetPos() if $oldcoords[0] <> $newcoords[0] then Exit if $oldcoords[1] <> $newcoords[1] then Exit $one = angle(@DesktopWidth/2, @DesktopHeight/2, $deg + ($add * 45), $len) $two = angle(@DesktopWidth/2, @DesktopHeight/2, $deg * $m + ($add * 45), $len) _GDIPlus_GraphicsDrawLine($hGraphic, $one[0], $one[1], $two[0], $two[1], $hPen) If $show = true Then $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) $OldBmp = GUICtrlSendMsg($ctrl, 0x0172, 0, $hBitmap2) If $OldBmp Then _WinAPI_DeleteObject($OldBmp) _WinAPI_DeleteObject($hBitmap2) Sleep($speed) EndIf Next _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap1) _GDIPlus_PenDispose($hPen) _GDIPlus_Shutdown() _WinAPI_DeleteObject($hBmp) EndFunc ;==>fracircle Func Angle($x1, $y1, $Ang, $Length, $round = 0) If $Ang >= 360 Then $Ang -= 360 Local $Return[2] $Return[0] = $x1 + ($Length * Cos($Ang / 180 * 3.14159265358979)) $Return[1] = $y1 - ($Length * Sin($Ang / 180 * 3.14159265358979)) If $round = 1 Then $Return[0] = Round($Return[0]) $Return[1] = Round($Return[1]) EndIf Return $Return EndFunc ;==>Angle func _exit() Exit EndFunc [center][/center][center]=][u][/u][/center][center][/center] Link to comment Share on other sites More sharing options...
smashly Posted August 30, 2009 Share Posted August 30, 2009 (edited) I have made some small modifications to make it run as a screensaver. expandcollapse popup#include <GUIConstantsEx.au3> #include <GDIPLus.au3> #include <WinAPI.au3> #include <ScreenCapture.au3> Global $gui, $pic, $s1, $s2, $s3, $s4, $s5, $b1, $c1, $msg, $show HotKeySet("{esc}", "_exit") $gui =GUICreate("GDI+ Circles", @DesktopWidth, @DesktopHeight, 0, 0, 0x80000000, 0x00000008) GUISetBkColor(0x000000) GUISetState() $pic = GUICtrlCreatePic("", 0, 0, @DesktopWidth, @DesktopHeight) ;GUICtrlCreateLabel("Size", 630, 35) ;$s1 = GUICtrlCreateSlider(600, 50, 200, 50);len ;GUICtrlSetLimit(-1, 290, 1) ;GUICtrlSetData(-1, 150) ;GUICtrlCreateLabel("Num of peaks", 630, 135) ;$s2 = GUICtrlCreateSlider(600, 150, 200, 50);peaks ;GUICtrlSetLimit(-1, 10, 2) ;GUICtrlSetData(-1, 2) ;GUICtrlCreateLabel("# of lines", 630, 235) ;$s3 = GUICtrlCreateSlider(600, 250, 200, 50);dist ;GUICtrlSetLimit(-1, 360, 10) ;GUICtrlSetData(-1, 100) ;GUICtrlCreateLabel("Inatial rotation", 630, 335) ;$s4 = GUICtrlCreateSlider(600, 350, 200, 50);add ;GUICtrlSetLimit(-1, 7, 0) ;GUICtrlSetData(-1, 2) ;GUICtrlCreateLabel("Draw Speed", 630, 435) ;$s5 = GUICtrlCreateSlider(600, 450, 200, 50);speed ;GUICtrlSetLimit(-1, 50, 0) ;GUICtrlSetData(-1, 30) GUISetState() ;$b1 = GUICtrlCreateButton("Export",630,500,100,30) ;$c1 = GUICtrlCreateCheckbox("Don't show drawing",630,535,150,20) ;$c2 = GUICtrlCreateCheckbox("crop export",630,555,150,20) $oldcoords = MouseGetPos() while 1 $newcoords = MouseGetPos() if $oldcoords[0] <> $newcoords[0] then Exit if $oldcoords[1] <> $newcoords[1] then Exit refreash() $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit ;Case $s1, $s2, $s3, $s4, $s5, $c1 ; refreash() ;;Case $b1 ; $name = InputBox("Export","Please enter image name, ex: cool awesome",Round(Random(1,9999999))) ; $pos = WinGetPos("GDI+ Circles") ; $len = GUICtrlRead($s1) ; WinActivate("GDI+ Circles") ; If GUICtrlRead($c2) = true Then ; _ScreenCapture_Capture($name & ".jpg", $pos[0]+ 293 - $len, $pos[1]+ 314 - $len, $pos[0] + 313 + $len, $pos[1] + 334 + $len, False) ; Else ; _ScreenCapture_Capture($name & ".jpg", $pos[0]+3, $pos[1]+24, $pos[0] + 603, $pos[1] + 604, False) ; EndIf EndSwitch WEnd Func refreash() Local $len, $dist, $peaks, $add, $speed, $show = True $len = Random(1, 600);GUICtrlRead($s1) $dist = (360 / Random(10, 360)) $peaks = Random(1, 10);GUICtrlRead($s2) $add = Random(1,7);GUICtrlRead($s4) $speed = 50 - Random(1, 50) ;If GUICtrlRead($c1) = $GUI_CHECKED Then $show = False fracircle($pic, $dist, $len, $peaks, $add, $speed, $show) EndFunc ;==>refreash Func fracircle($ctrl, $step, $len, $m = 2, $add = 3, $speed = 10, $show = True) Local $hBmp, $hPen, $hBitmap1, $hGraphic, $hBitmap2, $OldBmp, $one, $two $hBmp = _WinAPI_CreateBitmap(@DesktopWidth,@DesktopHeight, 1, 32) dim $colors[10] $colors[0] = 0xFFFFFFFF $colors[1] = 0xFF00FF00 $colors[2] = 0xFFFF0000 $colors[3] = 0xFF0000FF $colors[4] = 0xFFFF00FF $colors[5] = 0xFF00FFFF $colors[6] = 0xFF0033FF $colors[7] = 0xFFFF5500 $colors[8] = 0xFFFF55FF $colors[9] = 0xFF99FFFF _GDIPlus_Startup() $hPen = _GDIPlus_PenCreate($colors[Random(0,9,1)]) $hBitmap1 = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap1) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) For $deg = 0 To 360 Step $step $newcoords = MouseGetPos() if $oldcoords[0] <> $newcoords[0] then Exit if $oldcoords[1] <> $newcoords[1] then Exit $one = angle(@DesktopWidth/2, @DesktopHeight/2, $deg + ($add * 45), $len) $two = angle(@DesktopWidth/2, @DesktopHeight/2, $deg * $m + ($add * 45), $len) _GDIPlus_GraphicsDrawLine($hGraphic, $one[0], $one[1], $two[0], $two[1], $hPen) If $show = true Then $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) $OldBmp = GUICtrlSendMsg($ctrl, 0x0172, 0, $hBitmap2) If $OldBmp Then _WinAPI_DeleteObject($OldBmp) _WinAPI_DeleteObject($hBitmap2) Sleep($speed) EndIf Next _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap1) _GDIPlus_PenDispose($hPen) _GDIPlus_Shutdown() _WinAPI_DeleteObject($hBmp) EndFunc ;==>fracircle Func Angle($x1, $y1, $Ang, $Length, $round = 0) If $Ang >= 360 Then $Ang -= 360 Local $Return[2] $Return[0] = $x1 + ($Length * Cos($Ang / 180 * 3.14159265358979)) $Return[1] = $y1 - ($Length * Sin($Ang / 180 * 3.14159265358979)) If $round = 1 Then $Return[0] = Round($Return[0]) $Return[1] = Round($Return[1]) EndIf Return $Return EndFunc ;==>Angle func _exit() Exit EndFunc Hi, slight mod of your modded code.. lolexpandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPLus.au3> Opt("MustDeclareVars", 1) Opt("GUIOnEventMode", 1) Global $hGui, $iRefresh, $hPen, $hGraphic Global $iDW = @DesktopWidth, $iDH = @DesktopHeight, $iSquare = $iDH / 2 If $iDW < $iDH Then $iSquare = $iDW / 2 $hGui = GUICreate("GDI+ Circles", $iDW, $iDH, 0, 0, $WS_POPUP, $WS_EX_TOPMOST) GUISetCursor(16, 1, $hGui) GUISetState(@SW_SHOW, $hGui) _Start() While 1 refreash() Sleep(250) WEnd Func refreash() Local $len, $dist, $peaks, $add, $speed $len = Random(50, $iSquare, 1) $dist = (360 / Random(10, 360, 1)) $peaks = Random(2, 10, 1) $add = Random(0, 7, 1) $speed = Random(10, 30, 1) fracircle($dist, $len, $peaks, $add, $speed) EndFunc ;==>refreash Func fracircle($step, $len, $m = 2, $add = 3, $speed = 10) Local $one, $two, $iStart = 0, $iEnd = 360 If Random(1, 2, 1) <> 1 Then $iStart = 360 $iEnd = 0 $step = "-" & $step EndIf _GDIPlus_GraphicsClear($hGraphic, "0xFF" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)) _GDIPlus_PenSetColor($hPen, "0xFF" & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2) & Hex(Random(0, 255, 1), 2)) For $deg = $iStart To $iEnd Step $step $one = angle($iDW / 2, $iDH / 2, $deg + ($add * 45), $len) $two = angle($iDW / 2, $iDH / 2, $deg * $m + ($add * 45), $len) _GDIPlus_GraphicsDrawLine($hGraphic, $one[0], $one[1], $two[0], $two[1], $hPen) Sleep($speed) Next EndFunc ;==>fracircle Func Angle($x1, $y1, $Ang, $Length, $round = 0) Local $Return[2] If $Ang >= 360 Then $Ang -= 360 $Return[0] = $x1 + ($Length * Cos($Ang / 180 * 3.14159265358979)) $Return[1] = $y1 - ($Length * Sin($Ang / 180 * 3.14159265358979)) If $round = 1 Then $Return[0] = Round($Return[0]) $Return[1] = Round($Return[1]) EndIf Return $Return EndFunc ;==>Angle Func _Start() _GDIPlus_Startup() $hPen = _GDIPlus_PenCreate() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) GUISetOnEvent($GUI_EVENT_MOUSEMOVE, "_Quit", $hGui) GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit", $hGui) EndFunc ;==>_Start Func _Quit() _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_PenDispose($hPen) _GDIPlus_Shutdown() Exit EndFunc ;==>_Quit Cheers Edited August 30, 2009 by smashly Link to comment Share on other sites More sharing options...
Info Posted August 30, 2009 Share Posted August 30, 2009 Thats not related to this script. Does nothing but close when you push exit.I got this computer for over 2 years and it was the first time I had a blue screen, and it happened in the exact time I pushed X... Link to comment Share on other sites More sharing options...
monoceres Posted August 30, 2009 Share Posted August 30, 2009 I got this computer for over 2 years and it was the first time I had a blue screen, and it happened in the exact time I pushed X...AutoIt is a user-mode program, which means that it (should) not be possible to create bsod's from it. Broken link? PM me and I'll send you the file! Link to comment Share on other sites More sharing options...
corgano Posted September 1, 2009 Author Share Posted September 1, 2009 From a screensaver to a program, and now back to a screen saver. lol Working on a clock that uses this. It will be epic. 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
UEZ Posted September 1, 2009 Share Posted September 1, 2009 (edited) I never published the mentioned (by corgano) screensaver code . Hereby I will do it:expandcollapse popup;my 1st steps in GDI+ ;-) #Region #AutoIt3Wrapper_Outfile=Magic Lines Screensaver.exe #AutoIt3Wrapper_Res_Description=Very simple screensaver coded by UEZ using AutoIT #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_Language=1033 ://////=__= #AutoIt3Wrapper_Change2CUI=n #AutoIt3Wrapper_UseUpx=n #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0 #AutoIt3Wrapper_Res_SaveSource=n #AutoIt3Wrapper_Run_After=upx.exe --best "%out%" ;~ #AutoIt3Wrapper_run_after=upx.exe --ultra-brute "%out%" ;very slow #AutoIt3Wrapper_Run_After=move /y "Magic Lines Screensaver.exe" "Magic Lines Screensaver.scr" #AutoIt3Wrapper_Run_After=del "Magic Lines Screensaver_Obfuscated.au3" #EndRegion #include <GDIPlus.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Opt("GUIOnEventMode", 1) Opt("TrayIconHide", 1) If WinExists("ScrnSav:" & @ScriptFullPath) Then WinKill("ScrnSav:" & @ScriptFullPath) AutoItWinSetTitle("ScrnSav:" & @ScriptFullPath) Global $CommandLine Const $appname = "Magic Lines Screensaver" Const $ver = "0.75" Const $build = "2009-03-04" Global $hGUI, $hWnd, $hGraphic, $hPen, $x, $y, $x1, $x2, $y1, $y2, $i, $position, $radius, $radians, $stRegion, $min_size_factor Global $GUI_Name, $info, $info_pos, $rand, $rand_pos, $details, $wait, $diameter, $speed, $func, $func_detail, $name Global $color, $index, $last, $new Global $VirtualDesktopHeight, $VirtualDesktopWidth, $VirtualDesktopX, $VirtualDesktopY Dim $Array_of_Details[10] Global Const $Pi = 4 * ATan(1) ; thanks to james3mg for helping me to create SS $VirtualDesktopWidth = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 78);sm_virtualwidth $VirtualDesktopWidth = $VirtualDesktopWidth[0] $VirtualDesktopHeight = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 79);sm_virtualheight $VirtualDesktopHeight = $VirtualDesktopHeight[0] $VirtualDesktopX = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 76);sm_xvirtualscreen $VirtualDesktopX = $VirtualDesktopX[0] $VirtualDesktopY = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 77);sm_yvirtualscreen $VirtualDesktopY = $VirtualDesktopY[0] If $CmdLine[0] > 0 Then $CommandLine = StringLeft($CmdLine[1], 2) Else $CommandLine = "/s" EndIf If $CommandLine = "/s" Then $x = @DesktopWidth $y = @DesktopHeight $GUI_Name = $appname & " v" & $build & " by UEZ" $hGUI = GUICreate($GUI_Name, $VirtualDesktopWidth, $VirtualDesktopHeight, $VirtualDesktopX, $VirtualDesktopY, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) $hWnd = WinGetHandle($GUI_Name) GUISetCursor(16, 1) ; hide mouse cursor GUISetBkColor(0x000000) ; set screen backround _GDIPlus_Startup() ; initialize GDI+ $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) ; AntiAlias Ini() $info_pos = Random(0, @DesktopHeight - 55, 1) + Abs($VirtualDesktopY) ; set random y position on left side $info = GUICtrlCreateLabel($GUI_Name, $x - 80 + Abs($VirtualDesktopX), $info_pos, 90, 50) ; display info label on right side GUICtrlSetColor($info, 0x0000FF) ; set font color GUICtrlSetFont($info, 8) ; set font size $rand_pos = Random(0, @DesktopHeight - 20, 1) + Abs($VirtualDesktopY) $rand = GUICtrlCreateLabel($name & " | " & $diameter & " | " & $details, 4 + Abs($VirtualDesktopX), $rand_pos, 100, 16) ; display random numbers label on left side GUICtrlSetColor($rand, 0x2FCFFF) ; set font color GUICtrlSetFont($rand, 8) ; set font size GUISetState() $last = 0 While 1 $new = _IdleTicks() If $new < $last Then ExitLoop EndIf $last = $new Line_Color() ; generate line color Draw() ; draw lines WEnd Quit() ElseIf $CommandLine = "/c" Then MsgBox(64, "Information", "Nothing to configure yet, maybe later ;-)" & @CRLF & @CRLF & _ "© UEZ " & $build, 15) Exit ElseIf $CommandLine = "/p" Then ;display little preview Global $USER32 $x = 152 $y = 112 Global $hGUI = GUICreate($appname, $x, $y, 0, 0, 0x80000000) $hWnd = WinGetHandle($hGUI) $USER32 = DllOpen("user32.dll") DllCall($USER32, "int", "SetParent", "hwnd", $hGUI, "hwnd", HWnd($CmdLine[2])) ;set preview window DllClose($USER32) GUISetState() GUISetBkColor(0x000000) _GDIPlus_Startup() ; initialize GDI+ $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hWnd) $hPen = _GDIPlus_PenCreate(0x7FFFFFFF) ; define draw color using alpha blending _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) ; AntiAlias $VirtualDesktopY = 0 Ini() Local $parent_PID = _ProcessGetParent(@AutoItPID) Local $child_PID ; = _ProcessGetChildren($parent_PID) While 1 If Not WinExists($hWnd) Then Quit() $child_PID = _ProcessGetChildren($parent_PID) If $child_PID[0] > 1 Then Quit() ;if another screensaver is selected in ComboBox close ss Line_Color() Draw() WEnd EndIf Exit Func Ini() $Array_of_Details[0] = 0.50 ; array of detail levels $Array_of_Details[1] = 1.00 $Array_of_Details[2] = 1.50 $Array_of_Details[3] = 2.00 $Array_of_Details[4] = 2.50 $Array_of_Details[5] = 3.00 $Array_of_Details[6] = 3.50 $Array_of_Details[7] = 4.00 $Array_of_Details[8] = 4.50 $Array_of_Details[9] = 5.00 $speed = 10 $wait = 5000 ; wait 5 sec. $details = $Array_of_Details[Random(2, 9, 1)] ; select randomly detail level from array $i = 0 $min_size_factor = 8 $position = Random(2, 360, 1) ; set position for x2 and y2 $radius = Random($y / $min_size_factor, $y / 2, 1) ; set radius of the circle $diameter = $radius * 2 $radians = 180 * $details ;Random(90, 360, 1) ; set value convert from degrees to radians Random_Func() EndFunc ;==>Ini Func Draw() Select Case $func = 1 Shell() $name = "Shell" Case $func = 2 Space() $name = "Space" Case $func = 3 Star() $name = "Star" Case $func = 4 Circle() $name = "Circle" Case $func = 5 Nest() $name = "Nest" Case $func = 6 Abstract1() $name = "Abstract1" Case $func = 7 Rays() $name = "Rays" Case $func = 8 Star2() $name = "Star2" Case $func = 9 Disc() $name = "Disc" Case $func = 10 Color_Gradient() $name = "Color Gradient" Case $func = 11 Flower() $name = "Flower" EndSelect _GDIPlus_GraphicsDrawLine($hGraphic, Abs($VirtualDesktopX) + $x1, Abs($VirtualDesktopY) + $y1, Abs($VirtualDesktopX) + $x2, Abs($VirtualDesktopY) + $y2, $hPen) ;draw line _GDIPlus_PenDispose($hPen) $i += 1 Sleep($speed) If $i = 360 * $details * $func_detail Then Random_Func() $i = 0 $details = $Array_of_Details[Random(0, 9, 1)] $position = Random(2, 360, 1) $radius = Random($y / $min_size_factor, $y / 2, 1) $diameter = $radius * 2 $radians = 180 * $details ;Random(90, 360, 1) Sleep($wait) $stRegion = DllStructCreate($tagRECT) ; delete whole screen DllStructSetData($stRegion, 1, 0) DllStructSetData($stRegion, 2, 0) DllStructSetData($stRegion, 3, $VirtualDesktopWidth) DllStructSetData($stRegion, 4, $VirtualDesktopHeight) _WinAPI_InvalidateRect($hGUI, $stRegion, True) If $x >= 640 Then $rand = GUICtrlCreateLabel("", 4, $rand_pos, 100, 16) ; delete font on right side $info = GUICtrlCreateLabel("", $x - 80, $info_pos, 90, 50) ; delete font left side $rand_pos = Random($VirtualDesktopHeight - @DesktopHeight, $VirtualDesktopHeight - 20, 1) ; set new position for information right $rand = GUICtrlCreateLabel($name & " | " & $diameter & " | " & $details, 4, $rand_pos, 100, 16) ; print information GUICtrlSetColor($rand, 0x7FFFFF) ; set font color $info_pos = Random($VirtualDesktopHeight - @DesktopHeight, $VirtualDesktopHeight - 55, 1) ; set new position for information $info = GUICtrlCreateLabel($GUI_Name, $x - 80, $info_pos, 90, 50) ; print information GUICtrlSetColor($info, 0x0000FF) ; set font color GUICtrlSetFont($rand, 8) EndIf EndIf EndFunc ;==>Draw Func Random_Func() $func = Random(1, 11, 1) Select Case $func = 1 $name = "Shell" Case $func = 2 $name = "Space" Case $func = 3 $name = "Star" Case $func = 4 $name = "Circle" Case $func = 5 $name = "Nest" Case $func = 6 $name = "Abstract1" Case $func = 7 $name = "Rays" Case $func = 8 $name = "Star2" Case $func = 9 $name = "Disc" Case $func = 10 $name = "Color Gradient" Case $func = 11 $name = "Flower" EndSelect EndFunc ;==>Random_Func Func Line_Color() ;thanks to monoceres for the code Local $RedM = 1, $BlueM = 1.25, $GreenM = 1.50 $index += 0.0075 $color = "0x2F" & Hex(255 * ((Sin($index * $RedM) + 1) / 2), 2) & Hex(255 * ((Sin($index * $GreenM) + 1) / 2), 2) & Hex(255 * ((Sin($index * $BlueM) + 1) / 2), 2) $hPen = _GDIPlus_PenCreate($color) EndFunc ;==>Line_Color Func Color_Gradient() $x1 = 0 $y1 = $i $x2 = $radians * $i $y2 = 0 $func_detail = 1.50 EndFunc ;==>Color_Gradient Func Flower() $x1 = ATan($i / 180) ^ Sin($i / 180 * $Pi) + $x / 2 $y1 = ATan($i / 180) ^ Sin($i / 180 * $Pi) + $x / $Pi $x2 = $radians * Cos($i / 180 * $Pi) / Tan($i / 180) + $x / 2 $y2 = $radians * Cos($i / 180 * $Pi) / ATan($i / 180) + $x / $Pi $func_detail = 2.50 EndFunc ;==>Flower Func Disc() $x1 = $radians * Sin($i / 180 * $Pi) + $x / 2 $y1 = $radians * Cos($i / 180 * $Pi) + $x / $Pi $x2 = $radius * Sin($i / 180 * $Pi) + $x / 2 $y2 = $radius * Cos($i / 180 * $Pi) + $x / $Pi $func_detail = 1.5 EndFunc ;==>Disc Func Star2() Local $e $e = 2.71828182845904523536 $x1 = $radius * Cos($i * ($Pi / $radians)) / Tan($i) ^ $e ^ 1 / $i + $x / 2 $y1 = $radius * Sin($i * ($Pi / $radians)) * Tan($i) ^ $e ^ 1 / $i + $y / 2 $x2 = $radius * Cos($position * $i * ($Pi / $radians)) / Tan($i) + $x / 2 $y2 = $radius * Sin($position * $i * ($Pi / $radians)) * Tan($i) + $y / 2 $func_detail = 2.5 EndFunc ;==>Star2 Func Rays() Local $a, $b, $e $e = 2.71828182845904523536 $x1 = $radius * Cos($i ^ - 0.00000005 / ($Pi / $radians)) + $x / 2 $y1 = $radius * Sin($i ^ - 0.00000005 / ($Pi / $radians)) + $y / 2 $x2 = $radius * Cos($position * $i / ($Pi / $radians)) * $e ^ 1 / (Sin(-$i / 180) ^ - 0.00000005) + $x / 2 $y2 = $radius * Sin($position * $i / ($Pi / $radians)) * $e ^ 1 / (Tan(-$i / 180) ^ - 0.00000005) + $y / 2 $func_detail = 3.0 EndFunc ;==>Rays Func Abstract1() Local $a, $b, $e $e = 2.71828182845904523536 $a = ATan(($i / $Pi / 45)) $b = $i / $Pi / 270 $x1 = $i / $e ^ (1 / $i) $y1 = $x1 ^ $e ^ (1 / $i) $x2 = $radius * Sin($y1 / 180) - Cos($i * $Pi / 180) $y2 = $radius * $i * Tan($x2 / 180) $func_detail = 2 EndFunc ;==>Abstract1 Func Nest() Local $a $a = ATan((Sqrt($i * $Pi / 180))) $x1 = $radius * Cos($i / Sqrt($Pi * $radians)) / $a + $x / 2 $y1 = $radius * Sin($i / Sqrt($Pi * $radians)) / $a + $y / 2 $x2 = $radius * Sin($position / $i * Sqrt($Pi * $radians)) / $a + $x / 2 $y2 = $radius * Cos($position / $i * Sqrt($Pi * $radians)) / $a + $y / 2 $func_detail = 1.75 EndFunc ;==>Nest Func Shell() Local $a $a = Sin($i / 180 / $Pi) / Cos($i * 180 * $Pi) $x1 = $radius * Cos($i * Sin($Pi / $radians)) * $a + $x / 2 $y1 = $radius * Sin($i * Sin($Pi / $radians)) * $a + $y / 2 $x2 = $radius * Cos($position * $i * Cos($Pi / $radians)) * $a + $x / 2 ; $y2 = $radius * Sin($position * $i * Cos($Pi / $radians)) * $a + $y / 2 $func_detail = 1.50 EndFunc ;==>Shell Func Space() Local $a $a = Cos($i) * Sin($i) / ATan($i) * $Pi $x1 = $radius * Cos($i * ($Pi / $radians)) / $a + $x / 2 $y1 = $radius * Sin($i * ($Pi / $radians)) / $a + $y / 2 $x2 = $radius * Cos($position * $i * ($Pi / $radians)) / $a + $x / 2 ; $y2 = $radius * Sin($position * $i * ($Pi / $radians)) / $a + $y / 2 $func_detail = 1.50 EndFunc ;==>Space Func Star() $x1 = $radius * Cos($i * ($Pi / $radians)) * Tan($i) + $x / 2 $y1 = $radius * Sin($i * ($Pi / $radians)) / Tan($i) + $y / 2 $x2 = $radius * Cos($position * $i * ($Pi / $radians)) * Tan($i) + $x / 2 $y2 = $radius * Sin($position * $i * ($Pi / $radians)) / Tan($i) + $y / 2 $func_detail = 1.5 EndFunc ;==>Star Func Circle() $x1 = $radius * Cos($i * ($Pi / $radians)) + $x / 2 $y1 = $radius * Sin($i * ($Pi / $radians)) + $y / 2 $x2 = $radius * Cos($position * $i * ($Pi / $radians)) + $x / 2 $y2 = $radius * Sin($position * $i * ($Pi / $radians)) + $y / 2 $func_detail = 1.0 EndFunc ;==>Circle Func Quit() ; exit program _GDIPlus_PenDispose($hPen) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() Exit EndFunc ;==>Quit Func _ProcessGetParent($i_pid) ;get PID from parent process done by SmOke_N Local $TH32CS_SNAPPROCESS = 0x00000002 Local $a_tool_help = DllCall("Kernel32.dll", "long", "CreateToolhelp32Snapshot", "int", $TH32CS_SNAPPROCESS, "int", 0) If IsArray($a_tool_help) = 0 Or $a_tool_help[0] = -1 Then Return SetError(1, 0, $i_pid) Local $tagPROCESSENTRY32 = _ DllStructCreate( _ "dword dwsize;" & _ "dword cntUsage;" & _ "dword th32ProcessID;" & _ "uint th32DefaultHeapID;" & _ "dword th32ModuleID;" & _ "dword cntThreads;" & _ "dword th32ParentProcessID;" & _ "long pcPriClassBase;" & _ "dword dwFlags;" & _ "char szExeFile[260]" _ ) DllStructSetData($tagPROCESSENTRY32, 1, DllStructGetSize($tagPROCESSENTRY32)) Local $p_PROCESSENTRY32 = DllStructGetPtr($tagPROCESSENTRY32) Local $a_pfirst = DllCall("Kernel32.dll", "int", "Process32First", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32) If IsArray($a_pfirst) = 0 Then Return SetError(2, 0, $i_pid) Local $a_pnext, $i_return = 0 If DllStructGetData($tagPROCESSENTRY32, "th32ProcessID") = $i_pid Then $i_return = DllStructGetData($tagPROCESSENTRY32, "th32ParentProcessID") DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0]) If $i_return Then Return $i_return Return $i_pid EndIf While @error = 0 $a_pnext = DllCall("Kernel32.dll", "int", "Process32Next", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32) If DllStructGetData($tagPROCESSENTRY32, "th32ProcessID") = $i_pid Then $i_return = DllStructGetData($tagPROCESSENTRY32, "th32ParentProcessID") If $i_return Then ExitLoop $i_return = $i_pid ExitLoop EndIf WEnd DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0]) Return $i_return EndFunc ;==>_ProcessGetParent Func _ProcessGetChildren($i_pid) ; First level children processes only done by SmOke_N Local Const $TH32CS_SNAPPROCESS = 0x00000002 Local $a_tool_help = DllCall("Kernel32.dll", "long", "CreateToolhelp32Snapshot", "int", $TH32CS_SNAPPROCESS, "int", 0) If IsArray($a_tool_help) = 0 Or $a_tool_help[0] = -1 Then Return SetError(1, 0, $i_pid) Local $tagPROCESSENTRY32 = _ DllStructCreate _ ( _ "dword dwsize;" & _ "dword cntUsage;" & _ "dword th32ProcessID;" & _ "uint th32DefaultHeapID;" & _ "dword th32ModuleID;" & _ "dword cntThreads;" & _ "dword th32ParentProcessID;" & _ "long pcPriClassBase;" & _ "dword dwFlags;" & _ "char szExeFile[260]" _ ) DllStructSetData($tagPROCESSENTRY32, 1, DllStructGetSize($tagPROCESSENTRY32)) Local $p_PROCESSENTRY32 = DllStructGetPtr($tagPROCESSENTRY32) Local $a_pfirst = DllCall("Kernel32.dll", "int", "Process32First", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32) If IsArray($a_pfirst) = 0 Then Return SetError(2, 0, $i_pid) Local $a_pnext, $a_children[11] = [10], $i_child_pid, $i_parent_pid, $i_add = 0 $i_child_pid = DllStructGetData($tagPROCESSENTRY32, "th32ProcessID") If $i_child_pid <> $i_pid Then $i_parent_pid = DllStructGetData($tagPROCESSENTRY32, "th32ParentProcessID") If $i_parent_pid = $i_pid Then $i_add += 1 $a_children[$i_add] = $i_child_pid EndIf EndIf While 1 $a_pnext = DllCall("Kernel32.dll", "int", "Process32Next", "long", $a_tool_help[0], "ptr", $p_PROCESSENTRY32) If IsArray($a_pnext) And $a_pnext[0] = 0 Then ExitLoop $i_child_pid = DllStructGetData($tagPROCESSENTRY32, "th32ProcessID") If $i_child_pid <> $i_pid Then $i_parent_pid = DllStructGetData($tagPROCESSENTRY32, "th32ParentProcessID") If $i_parent_pid = $i_pid Then If $i_add = $a_children[0] Then ReDim $a_children[$a_children[0] + 10] $a_children[0] = $a_children[0] + 10 EndIf $i_add += 1 $a_children[$i_add] = $i_child_pid EndIf EndIf WEnd If $i_add <> 0 Then ReDim $a_children[$i_add + 1] $a_children[0] = $i_add EndIf DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0]) If $i_add Then Return $a_children Return SetError(3, 0, 0) EndFunc ;==>_ProcessGetChildren Func _IdleTicks() ; thanks to erifash for the routine Local $aTSB = DllCall("kernel32.dll", "long", "GetTickCount") Local $ticksSinceBoot = $aTSB[0] Local $struct = DllStructCreate("uint;dword") DllStructSetData($struct, 1, DllStructGetSize($struct)) DllCall("user32.dll", "int", "GetLastInputInfo", "ptr", DllStructGetPtr($struct)) Local $ticksSinceIdle = DllStructGetData($struct, 2) Return ($ticksSinceBoot - $ticksSinceIdle) EndFunc ;==>_IdleTicksIt is unfinished. If you like you can add more funtions and do a config window, etc.As mentioned in post #5 this was my 1st step in GDI+, so don't blame me UEZPS: strange behaviour of some functions with AMD CPU(s) (e.g. AMD XP 3000+)! Edited September 1, 2009 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
corgano Posted September 2, 2009 Author Share Posted September 2, 2009 Sweet. Ever thought of finishing it? The preferences box could be tabbed, with a tab for each fractal it draws. The magic circles could have settings similar to mine.... 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e Link to comment Share on other sites More sharing options...
Wooltown Posted September 4, 2009 Share Posted September 4, 2009 With random colors for each line ! expandcollapse popup#include <GUIConstantsEx.au3> #include <GDIPLus.au3> #include <WinAPI.au3> #include <ScreenCapture.au3> Global $gui, $pic, $s1, $s2, $s3, $s4, $s5, $b1, $c1, $msg, $show $gui = GUICreate("GDI+ Circles", 800, 600) $pic = GUICtrlCreatePic("", 0, 0, 600, 600) GUICtrlCreateLabel("Size", 630, 35) $s1 = GUICtrlCreateSlider(600, 50, 200, 50);len GUICtrlSetLimit(-1, 290, 1) GUICtrlSetData(-1, 150) GUICtrlCreateLabel("Num of peaks", 630, 135) $s2 = GUICtrlCreateSlider(600, 150, 200, 50);peaks GUICtrlSetLimit(-1, 10, 2) GUICtrlSetData(-1, 2) GUICtrlCreateLabel("# of lines", 630, 235) $s3 = GUICtrlCreateSlider(600, 250, 200, 50);dist GUICtrlSetLimit(-1, 360, 10) GUICtrlSetData(-1, 100) GUICtrlCreateLabel("Inatial rotation", 630, 335) $s4 = GUICtrlCreateSlider(600, 350, 200, 50);add GUICtrlSetLimit(-1, 7, 0) GUICtrlSetData(-1, 2) GUICtrlCreateLabel("Draw Speed", 630, 435) $s5 = GUICtrlCreateSlider(600, 450, 200, 50);speed GUICtrlSetLimit(-1, 50, 0) GUICtrlSetData(-1, 30) GUISetState() $b1 = GUICtrlCreateButton("Export",630,500,100,30) $c1 = GUICtrlCreateCheckbox("Don't show drawing",630,535,150,20) $c2 = GUICtrlCreateCheckbox("crop export",630,555,150,20) refreash() While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE Exit Case $s1, $s2, $s3, $s4, $s5, $c1 refreash() Case $b1 $name = InputBox("Export","Please enter image name, ex: cool awesome",Round(Random(1,9999999))) $pos = WinGetPos("GDI+ Circles") $len = GUICtrlRead($s1) WinActivate("GDI+ Circles") If GUICtrlRead($c2) = true Then _ScreenCapture_Capture($name & ".jpg", $pos[0]+ 293 - $len, $pos[1]+ 314 - $len, $pos[0] + 313 + $len, $pos[1] + 334 + $len, False) Else _ScreenCapture_Capture($name & ".jpg", $pos[0]+3, $pos[1]+24, $pos[0] + 603, $pos[1] + 604, False) EndIf EndSwitch WEnd Func refreash() Local $len, $dist, $peaks, $add, $speed, $show = True $len = GUICtrlRead($s1) $dist = (360 / GUICtrlRead($s3)) $peaks = GUICtrlRead($s2) $add = GUICtrlRead($s4) $speed = 50 - GUICtrlRead($s5) If GUICtrlRead($c1) = $GUI_CHECKED Then $show = False fracircle($pic, $dist, $len, $peaks, $add, $speed, $show) EndFunc ;==>refreash Func fracircle($ctrl, $step, $len, $m = 2, $add = 3, $speed = 10, $show = True) Local $hBmp, $hPen, $hBitmap1, $hGraphic, $hBitmap2, $OldBmp, $one, $two, $rgb $hBmp = _WinAPI_CreateBitmap(600, 600, 1, 32) _GDIPlus_Startup() $rgb = String ("FF" & Hex(Random (0,255,1),2) & Hex(Random (0,255,1),2) & Hex(Random (0,255,1),2)) $hPen = _GDIPlus_PenCreate("0x" & $rgb) $hBitmap1 = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) $hGraphic = _GDIPlus_ImageGetGraphicsContext($hBitmap1) _GDIPlus_GraphicsSetSmoothingMode($hGraphic, 4) For $deg = 0 To 360 Step $step $one = angle(300, 300, $deg + ($add * 45), $len) $two = angle(300, 300, $deg * $m + ($add * 45), $len) $rgb = String ("FF" & Hex(Random (0,255,1),2) & Hex(Random (0,255,1),2) & Hex(Random (0,255,1),2)) $hPen = _GDIPlus_PenCreate("0x" & $rgb) _GDIPlus_GraphicsDrawLine($hGraphic, $one[0], $one[1], $two[0], $two[1], $hPen) _GDIPlus_PenDispose($hPen) If $show = true Then $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) $OldBmp = GUICtrlSendMsg($ctrl, 0x0172, 0, $hBitmap2) If $OldBmp Then _WinAPI_DeleteObject($OldBmp) _WinAPI_DeleteObject($hBitmap2) Sleep($speed) EndIf Next If $show = False Then $hBitmap2 = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap1) $OldBmp = GUICtrlSendMsg($ctrl, 0x0172, 0, $hBitmap2) If $OldBmp Then _WinAPI_DeleteObject($OldBmp) _WinAPI_DeleteObject($hBitmap2) EndIf _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_BitmapDispose($hBitmap1) ;_GDIPlus_PenDispose($hPen) _GDIPlus_Shutdown() _WinAPI_DeleteObject($hBmp) EndFunc ;==>fracircle Func Angle($x1, $y1, $Ang, $Length, $round = 0) If $Ang >= 360 Then $Ang -= 360 Local $Return[2] $Return[0] = $x1 + ($Length * Cos($Ang / 180 * 3.14159265358979)) $Return[1] = $y1 - ($Length * Sin($Ang / 180 * 3.14159265358979)) If $round = 1 Then $Return[0] = Round($Return[0]) $Return[1] = Round($Return[1]) EndIf Return $Return EndFunc ;==>Angle Link to comment Share on other sites More sharing options...
corgano Posted September 4, 2009 Author Share Posted September 4, 2009 What if it were a rainbow patteren.... 0x616e2069646561206973206c696b652061206d616e20776974686f7574206120626f64792c20746f206669676874206f6e6520697320746f206e657665722077696e2e2e2e2e 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