1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. UEZ

Beiträge von UEZ

  • Ball soll treu dem Reflexionsgesetz an etwas abprallen.

    • UEZ
    • 19. September 2009 um 15:17

    War doch nicht so schwer oder? :thumbup:

    Du solltest auf die Pfade achten, wenn du deinen Code postest -> $ball = GUICtrlCreateIcon("C:\Users\Tim\Desktop\Block Breaker\circle.ico", 0, $ballleft, $balltop, 16, 16)...

    Apropos Kollision: kannst ja mal hier schauen: #10 Simple Ball Collision Simulation. Mein Versuch mit Kollisionen zwischen Kugeln...

    UEZ ;)

  • Ball soll treu dem Reflexionsgesetz an etwas abprallen.

    • UEZ
    • 18. September 2009 um 23:57
    Zitat von Techmix

    Da ist er ja, unser GDI+ Gott!
    Neee im ernst, ich glaub nicht das sich jemand hier besser mit GDI auskennt als UEZ!!

    Wenn er meint das du vx mit xy Multiplizieren solltest, damit xyz rauskommt; dann ist das so :rock: :rock:


    Will ja nicht Schleimen oder so :rolleyes:

    Das hat eigentlicht nichts mit GDI+ zu tun, sondern mit Mathe :D GDI+ ist nur ein Darstellungsmedium für die Mathematik/Physik.

    Meine GDI+ Codes finde ich persönlich nicht Gott-Like, sondern nur OK! Ich interessiere mich eben mehr für die grafische Darstellung...

    UEZ

  • Ball soll treu dem Reflexionsgesetz an etwas abprallen.

    • UEZ
    • 18. September 2009 um 23:49

    Ob das jetzt mit GDI+ oder guictrlsetpos() machst, ist erstmal egal.

    Das Objekt bewegt sich mit vx und vy in eine Richtung. Wenn es jetzt zu einer Kollision kommt (vernachlässigen wir mal Drall und andere Faktoren), dann sollte das Objekt sich in eine andere Richtung bewegen.

    Stell dir mal vor, dass eine Kugel sich nur waagerecht bewegt (<-->) und sich an der linken bzw. rechten Bande abstößt. Das heißt, der x Wert ist z.B. aufsteigend, bis die rechte Bande erreicht ist, danach verkleinert sich der x wieder, bis er wieder an die linke Bande stößt. Analog mit der y Achse.

    In meinem Beispiel siehst du unter Func Calculate_New_Position(), wie die neue Position berechnet wird. Je nach Variante wird der Wert einfach mit -1 multipliziert.

    $coordinates[$k][3] bzw. $coordinates[$k][4] sind die Bewegungsvektoren für die x/y Bewegung.

    Ist schwierig zu erklären, aber vielleicht nimmt ihr ja mal Vektoren in Mathe durch... Ich hatte das in der Oberstufe...

    UEZ

  • Ball soll treu dem Reflexionsgesetz an etwas abprallen.

    • UEZ
    • 18. September 2009 um 23:12

    Du muss einfach das entsprechende Vorzeichen ändern.

    In deinem Beispiel fliegt die Kugel mit 2 Vektoren, sagen wir mal vx und vy. Beim Aufprall unten multipliziert du einfach den Vektor vy mit -1. Dadurch bekommst du den neuen Winkel (Vektor v) und musst im Prinzip nur die Kollision berechnen!

    Hier ein Beispiel in GDI+

    Spoiler anzeigen

    ;coded by UEZ 2009
    #include <GUIConstantsEx.au3>
    #include <GDIplus.au3>
    #include <WindowsConstants.au3>

    Global Const $width = @DesktopWidth / 2
    Global Const $height = @DesktopHeight / 2

    Opt("GUIOnEventMode", 1)
    Global $hwnd = GUICreate("Border Collision!", $width, $height, -1, -1, Default, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
    GUISetOnEvent($GUI_EVENT_CLOSE, "close")
    GUISetState()

    _GDIPlus_Startup()
    Global $graphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
    Global $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    Global $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    _GDIPlus_GraphicsClear($backbuffer)
    _GDIPlus_GraphicsSetSmoothingMode($backbuffer, 4)
    Global $brush_color
    Global $brush = _GDIPlus_BrushCreateSolid()
    _GDIPlus_BrushSetSolidColor($brush, $brush_color)
    Global $max_dots = 1
    Global $max_speed = 5
    Global $iWidth = 60
    Global $iHeight = 60
    Dim $coordinates[$max_dots][5], $angle
    Dim $brush[$max_dots]
    Initialize()

    Do
    _GDIPlus_GraphicsClear($backbuffer, 0xFF000000)
    Draw_Dots()
    Calculate_New_Position()
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
    Sleep(5)
    Until False

    Func Initialize()
    For $k = 0 To $max_dots - 1
    $r = Random(64, 255, 1)
    $g = Random(64, 255, 1)
    $b = Random(64, 255, 1)
    $brush_color = "0xAF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
    $brush[$k] = _GDIPlus_BrushCreateSolid($brush_color)
    New_Coordinates($k)
    Next
    EndFunc ;==>Initialize

    Func Draw_Dots()
    Local $i, $temp_x, $temp_y
    For $i = 0 To $max_dots - 1
    _GDIPlus_GraphicsFillEllipse($backbuffer, $coordinates[$i][0], $coordinates[$i][1], $iWidth, $iHeight, $brush[$i])
    Next
    EndFunc ;==>Draw_Dots

    Func New_Coordinates($k)
    $coordinates[$k][0] = $width / 2 ;Random($width / 20, $width - $width / 20, 1);start x position
    $coordinates[$k][1] = $height / 2 ;Random($height / 20, $height - $height / 20, 1) ;start y position
    $coordinates[$k][2] = Random(1, $max_speed, 1) ;speed of pixel
    $angle = Random(0, 359, 1)
    ConsoleWrite("Angle: " & $angle & "°" & @CRLF)
    $coordinates[$k][3] = $coordinates[$k][2] * Cos($angle * 3.141592653 / 180)
    $coordinates[$k][4] = $coordinates[$k][2] * Sin($angle * 3.141592653 / 180)
    EndFunc ;==>New_Coordinates

    Func Calculate_New_Position()
    Local $k
    For $k = 0 To $max_dots - 1
    $coordinates[$k][0] += $coordinates[$k][3] ;increase x coordinate with appropriate slope
    $coordinates[$k][1] += $coordinates[$k][4] ;increase y coordinate with appropriate slope
    If $coordinates[$k][0] <= 0 Then ;border collision x left
    $coordinates[$k][0] = 1
    $coordinates[$k][3] *= -1
    ElseIf $coordinates[$k][0] >= $width - $iWidth Then ;border collision x right
    $coordinates[$k][0] = $width - ($iWidth + 1)
    $coordinates[$k][3] *= -1
    EndIf
    If $coordinates[$k][1] <= 0 Then ;border collision y top
    $coordinates[$k][1] = 1
    $coordinates[$k][4] *= -1
    ElseIf $coordinates[$k][1] >= $height - $iHeight Then ;border collision y bottom
    $coordinates[$k][1] = $height - ($iHeight + 1)
    $coordinates[$k][4] *= -1
    EndIf
    Next
    EndFunc ;==>Calculate_New_Position


    Func close()
    _GDIPlus_BrushDispose($brush)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>close

    Func _GDIPlus_BrushSetSolidColor($hBrush, $iARGB = 0xFF000000)
    Local $aResult
    $aResult = DllCall($ghGDIPDll, "int", "GdipSetSolidFillColor", "hwnd", $hBrush, "int", $iARGB)
    If @error Then Return SetError(@error, @extended, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc ;==>_GDIPlus_BrushSetSolidColor

    Ich hoffe, dass das dir das hilft :)

    UEZ

  • Screensaver layout?

    • UEZ
    • 16. September 2009 um 11:18

    Und? Ist der Code verständlich? Konntest du das Layout erstellen?

    Gruß,
    UEZ

  • Screensaver layout?

    • UEZ
    • 14. September 2009 um 10:59

    Hallo tobi_girst,

    leider kann ich dir nicht via AutoIt.de antworten, da deine Mail nur zu meiner Email Adresse geschickt wurden, aber in Auto.de nicht verfügbar ist.

    Schaue dir doch mal den beigefügten Code genauer an. Falls du Hilfe benötigst, dann melde dich einfach!

    Gruß,
    UEZ

  • Screensaver layout?

    • UEZ
    • 13. September 2009 um 17:50

    Vielleicht hilft dir ja dieser Beitrag weiter GDI+ Screensaver (Magic Lines Screensaver) ;)

    Punkte 1-3 sind u.a. implementiert, wobei Punkt 2 nur eine Messagebox ist (ich war zu faul für ein Settings Menue :whistling: )

    Gruß,
    UEZ

  • SuperMario Gameplay und Download

    • UEZ
    • 12. September 2009 um 22:32

    Sau geile Implementierung! :thumbup:

    Respekt!


    UEZ

  • GDI+ CloneArea Problem

    • UEZ
    • 3. September 2009 um 22:25

    Kannst du bitte mir nochmals erklären, was du genau machen willst!

    Ich dachte, dass du ein Bild laden und es anschließend auf irgendeine Seite clonen willst! ?(

    UEZ

  • GDI+ CloneArea Problem

    • UEZ
    • 3. September 2009 um 20:53

    Hilft dir dieser Thread vielleicht -> [ gelöst ] Gdi+ Clone/Save

    Gruß,
    UEZ

  • Die Länge einer Linie anhand 2 Koordinaten herausfinden

    • UEZ
    • 3. September 2009 um 19:40
    [autoit]

    Func Pixel_Distance($x1, $y1, $x2, $y2) ;Pythagoras theorem
    Local $a, $b, $c
    If $x2 = $x1 And $y2 = $y1 Then
    Return 0
    Else
    $a = $y2 - $y1
    $b = $x2 - $x1
    $c = Sqrt($a * $a + $b * $b)
    Return $c
    EndIf
    EndFunc ;==>Pixel_Distance

    [/autoit]

    Gruß,
    UEZ

  • Mit GDI+ um einen Punkt Striche Zeichnen

    • UEZ
    • 3. September 2009 um 19:38

    Sorry, hatte ein Fehler in meinem Beispiel in Post#3 -> korrigiert!

    UEZ

  • Mit GDI+ um einen Punkt Striche Zeichnen

    • UEZ
    • 3. September 2009 um 19:03

    Hier mein Vorschlag:

    Spoiler anzeigen


    ;code by UEZ
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <GUIConstants.au3>
    #include <GDIPlus.au3>


    Global Const $width = 800
    Global Const $height = 800
    Global $graphics, $backbuffer, $bitmap, $hPen, $i, $pi_div_180 = 4 * ATan(1) / 180, $index, $color
    Global $radius_x = ($width * 0.5) * 0.90, $radius_y = ($height * 0.5) * 0.90
    Global $title = "GDI+ Beispiel"

    Opt("GUIOnEventMode", 1)
    $hwnd = GUICreate($title, $width, $height, -1, -1, BitOR($WS_SYSMENU,$WS_DLGFRAME,$WS_POPUP))
    GUISetOnEvent($GUI_EVENT_CLOSE, "close")
    GUISetState()

    _GDIPlus_Startup()
    $graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
    $bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
    $backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
    $hPen = _GDIPlus_PenCreate(0xFFFFFFFF, 8)
    _GDIPlus_GraphicsClear($backbuffer)
    Do
    Line_Color()
    ;~ _GDIPlus_GraphicsClear($backbuffer)
    ;~ _GDIPlus_GraphicsDrawEllipse($backbuffer, $width * 0.5 + Cos($i * $pi_div_180) * $radius_x, $height * 0.5 + Sin($i * $pi_div_180) * $radius_y, 1, 1, $hPen)
    _GDIPlus_GraphicsDrawLine($backbuffer, $width / 2, $height / 2, $width * 0.5 + Cos($i * $pi_div_180) * $radius_x, $height * 0.5 + Sin($i * $pi_div_180) * $radius_y, $hPen)
    _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
    $i += 1
    If $i >= 360 Then $i = 0
    Sleep(10)
    Until False

    Func Line_Color()
    Local $RedM = 1, $BlueM = 1.25, $GreenM = 1.50
    $index += 0.075
    $color = "0xFF" & Hex(255 * ((Sin($index * $RedM) + 1) / 2), 2) & Hex(255 * ((Sin($index * $GreenM) + 1) / 2), 2) & Hex(255 * ((Sin($index * $BlueM) + 1) / 2), 2)
    _GDIPlus_PenSetColor($hPen, $color)
    EndFunc ;==>Line_Color

    Func close()
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($backbuffer)
    _GDIPlus_BitmapDispose($bitmap)
    _GDIPlus_GraphicsDispose($graphics)
    _GDIPlus_Shutdown()
    WinClose($hwnd)
    Exit
    EndFunc

    Das Problem ist hier in meinem Bsp. nicht GDI+, sondern die Mathematik (Trigonometrie) :D

    Gruß,
    UEZ

  • GDI+ Screensavers (jetzt mit 2 Beispielen)

    • UEZ
    • 3. September 2009 um 18:41
    Zitat von progandy

    ich meine, ich hab mal ein paar schiefe Linien gesehen, bei nem Stern glaub ich ;)
    (AMD Athlon 64 X" Dual Core 3800+)
    /
    /Edit: Star2 wars [Blockierte Grafik: http://www.abload.de/thumb/star2pch8.png]

    Danke für deine Antwort, aber das ist "normal". Ich kann es nicht erklären, warum vereinzelte Linien aus der Reihe tanzen, lässt sich irgendwie aber mathematisch erklären ?(

    Was ich meine, ist z.B. das bei den Rays aus der Mitte die Strahlen nach außen gehen (oder umgekehrt, je nach dem wie man die Richtung sieht), aber auf meinem AMD Athlon XP 3000+ verliefen die Linien zum Teil mitten beim Zeichnen von links oben in der Ecke in alle Richtungen!
    Intel CPU's scheinen die Division durch 0 anders darzustellen als AMD CPUs oder zumindest mein AMD XP 3000+ tat dies. Leider habe die CPU nicht mehr.

    Das war mir nur eingefallen und wollte wissen, ob das jemanden noch auffällt bzw. aufgefallen ist!

    Hast du den Code umgestrickt, um Screenshot zu machen? ;)
    Gruß,
    UEZ

  • GDI+ Screensavers (jetzt mit 2 Beispielen)

    • UEZ
    • 2. September 2009 um 23:16

    @all: danke für das Feedback ^^

    Gab's auf AMD CPUs probleme (falsche Darstellung der Linien, z.B. bei Rays)?

    Gruß,
    UEZ

    PS: Ich bin jetzt "GDI+-Zauberer und Lernender" :D

  • GDI+ Plasma - eine andere Variante :-)

    • UEZ
    • 2. September 2009 um 16:15

    Ich habe da noch was Älteres gefunden, was ich so direkt nie veröffentlicht habe :whistling:

    Ist noch Beta, da ich nach einer schnelleren Routine suche! Ich habe das zwar schon was, aber mal sehen...

    Vielleicht gefällt es euch ja :D

    Gruß,
    UEZ

  • MP3-Double-Finder

    • UEZ
    • 2. September 2009 um 11:29

    Nach dem ich "Suche starten..." gedrückt habe und er nicht gefunden hat, ist immer noch der Button ausgegraut!

    Nett wäre noch ein "Abbruch" Button.

    Cool wäre es, wenn man den Musikinhalt Binär vergleichen könnte, d.h. MP3 Part extrahieren und dann ein Binärvergleich (MD5?). Denn es könnte ja z.B. sein, dass die Mp3 Datei gleich ist, aber der Name/Tag anders -> ü->ue, ä->ae, ö->oe.

    Gruß,
    UEZ

  • GDI+ Screensavers (jetzt mit 2 Beispielen)

    • UEZ
    • 1. September 2009 um 19:56

    Hier ein Screensaver (Magic Lines Screensaver), den ich Anfang März 2008 angefangen (meine ersten Versuche mit GDI+) und nicht mehr weiter entwickelt habe.

    Vielleicht ist er ja für jemanden nützlich!

    Auf AMD Prozessoren können die Linien falsch dargestellt werden (Division durch Null) :!:

    Spoiler anzeigen
    [autoit]


    ;~ 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_Res_Field=Coded by|UEZ 2008
    #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

    [/autoit] [autoit][/autoit] [autoit]

    #include <GDIPlus.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt('MustDeclareVars', 1)
    Opt("GUIOnEventMode", 1)
    Opt("TrayIconHide", 1)

    [/autoit] [autoit][/autoit] [autoit]

    If WinExists("ScrnSav:" & @ScriptFullPath) Then WinKill("ScrnSav:" & @ScriptFullPath)
    AutoItWinSetTitle("ScrnSav:" & @ScriptFullPath)

    [/autoit] [autoit][/autoit] [autoit]

    Global $CommandLine

    [/autoit] [autoit][/autoit] [autoit]

    Const $appname = "Magic Lines Screensaver"
    Const $ver = "0.75"
    Const $build = "2009-03-04"

    [/autoit] [autoit][/autoit] [autoit]

    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, $pen_size
    Global $VirtualDesktopHeight, $VirtualDesktopWidth, $VirtualDesktopX, $VirtualDesktopY
    Dim $Array_of_Details[10]
    Global Const $Pi = 4 * ATan(1)

    [/autoit] [autoit][/autoit] [autoit]

    ; 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]

    [/autoit] [autoit][/autoit] [autoit]

    If $CmdLine[0] > 0 Then
    $CommandLine = StringLeft($CmdLine[1], 2)
    Else
    $CommandLine = "/s"
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If $CommandLine = "/s" Then

    [/autoit] [autoit][/autoit] [autoit]

    $x = @DesktopWidth
    $y = @DesktopHeight

    [/autoit] [autoit][/autoit] [autoit]

    $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)

    [/autoit] [autoit][/autoit] [autoit]

    GUISetCursor(16, 1) ; hide mouse cursor
    GUISetBkColor(0x000000) ; set screen backround

    [/autoit] [autoit][/autoit] [autoit]

    _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

    [/autoit] [autoit][/autoit] [autoit]

    $pen_size = Random(1, 16, 1)
    $rand_pos = Random(0, @DesktopHeight - 20, 1) + Abs($VirtualDesktopY)
    $rand = GUICtrlCreateLabel($name & " | " & $diameter & " | " & $details & " | " & $pen_size, 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

    [/autoit] [autoit][/autoit] [autoit]

    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 & _
    "(c) 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

    [/autoit] [autoit][/autoit] [autoit]

    Exit

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    $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

    [/autoit] [autoit][/autoit] [autoit]

    Random_Func()
    EndFunc ;==>Ini

    [/autoit] [autoit][/autoit] [autoit]

    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
    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)

    [/autoit] [autoit][/autoit] [autoit]

    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)
    $pen_size = Random(1, 16, 1)

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    $rand_pos = Random($VirtualDesktopHeight - @DesktopHeight, $VirtualDesktopHeight - 20, 1) ; set new position for information right
    $rand = GUICtrlCreateLabel($name & " | " & $diameter & " | " & $details & " | " & $pen_size, 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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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, $pen_size)
    EndFunc ;==>Line_Color

    [/autoit] [autoit][/autoit] [autoit]

    Func Color_Gradient()
    $x1 = 0
    $y1 = $i
    $x2 = $radians * $i
    $y2 = 0
    $func_detail = 1.50
    EndFunc ;==>Color_Gradient

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    Func Abstract1()
    Local $a, $b, $e
    $e = 2.71828182845904523536
    $a = ATan(($i / $Pi / 45))
    $b = $i / $Pi / 270

    [/autoit] [autoit][/autoit] [autoit]

    $x1 = $i / $e ^ (1 / $i)
    $y1 = $x1 ^ $e ^ (1 / $i)

    [/autoit] [autoit][/autoit] [autoit]

    $x2 = $radius * Sin($y1 / 180) - Cos($i * $Pi / 180)
    $y2 = $radius * $i * Tan($x2 / 180)

    [/autoit] [autoit][/autoit] [autoit]

    $func_detail = 2
    EndFunc ;==>Abstract1

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func Quit() ; exit program
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>Quit

    [/autoit] [autoit][/autoit] [autoit]

    Func _ProcessGetParent($i_pid) ;get PID from parent process done by SmOke_N
    Local $TH32CS_SNAPPROCESS = 0x00000002

    [/autoit] [autoit][/autoit] [autoit]

    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)

    [/autoit] [autoit][/autoit] [autoit]

    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))

    [/autoit] [autoit][/autoit] [autoit]

    Local $p_PROCESSENTRY32 = DllStructGetPtr($tagPROCESSENTRY32)

    [/autoit] [autoit][/autoit] [autoit]

    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)

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0])
    Return $i_return
    EndFunc ;==>_ProcessGetParent

    [/autoit] [autoit][/autoit] [autoit]

    Func _ProcessGetChildren($i_pid) ; First level children processes only done by SmOke_N
    Local Const $TH32CS_SNAPPROCESS = 0x00000002

    [/autoit] [autoit][/autoit] [autoit]

    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)

    [/autoit] [autoit][/autoit] [autoit]

    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))

    [/autoit] [autoit][/autoit] [autoit]

    Local $p_PROCESSENTRY32 = DllStructGetPtr($tagPROCESSENTRY32)

    [/autoit] [autoit][/autoit] [autoit]

    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)

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    If $i_add <> 0 Then
    ReDim $a_children[$i_add + 1]
    $a_children[0] = $i_add
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    DllCall("Kernel32.dll", "int", "CloseHandle", "long", $a_tool_help[0])
    If $i_add Then Return $a_children
    Return SetError(3, 0, 0)
    EndFunc ;==>_ProcessGetChildren

    [/autoit] [autoit][/autoit] [autoit]

    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 ;==>_IdleTicks

    [/autoit]


    Gruß,
    UEZ


    PS: Bitte nicht blamieren, da der Code (95%) noch aus der Zeit Anfang 2008 stammt und unverändert ist :rolleyes:. Außerdem bin ich auch kein GDI+ Guru!

  • Pfad von einen process heruasfinden?

    • UEZ
    • 28. Juli 2009 um 10:20

    Bin im Urlaub und kann das nicht testen!

    Quelle von hier :

    Spoiler anzeigen

    $list = ProcessList("SvcHost.exe")
    for $i = 1 to $list[0][0]
    $pid = $list[$i][1]
    Local $hProc = DllCall("kernel32.dll", "int", "OpenProcess", "int", 0x0410, "int", False, "int", $pid)
    If $hProc[0] Then
    Local $stHMod = DllStructCreate("int hMod")
    Local $stCB = DllStructCreate("dword cbNeeded")
    Local $resEnum = DllCall("psapi.dll", "int", "EnumProcessModules", "int", $hProc[0], "ptr", DllStructGetPtr($stHMod), "dword", DllStructGetSize($stHMod), "ptr", DllStructGetPtr($stCB, 1))
    If $resEnum[0] Then
    Local $resPath = DllCall("psapi.dll", "int", "GetModuleFileNameEx", "int", $hProc[0], "int", DllStructGetData($stHMod, 1), "str", "", "dword", 32768)
    MsgBox(0, "PID 2 Path", "" & $Pid & " = " & $resPath[3])
    EndIf
    $stHMod = 0
    $stCB = 0
    DllCall("kernel32.dll", 'int', 'CloseHandle', 'int', $hProc[0])
    EndIf
    Next

    Grüsse aus Fethiye ;)

    UEZ

  • Pairs (Spiel für Kinder)

    • UEZ
    • 8. Juli 2009 um 17:43

    Nettes Spiel Oscar, auch für nicht Kinder (Erwachsene)!

    Gibt es auch Levels?

    Endlich kann ich mein Gehirn (Schweizer Käse) trainieren :D

    Was wollte ich eigentlich noch sagen....

    UEZ ;)

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™