Sorry, sollte auch ohne die APIConstants.au3 laufen, die in der WinAPIEX UDF sein sollte.
Gruß,
UEZ
Sorry, sollte auch ohne die APIConstants.au3 laufen, die in der WinAPIEX UDF sein sollte.
Gruß,
UEZ
Da ich relativ oft Binär Strings verwende, um Bilder, Sounds, etc. direkt vom Speicher zu lesen, habe ich kleines Tool dazu geschrieben, das eine Datei in einen Base64 String umwandelt und gleich als Funktion bereit stellt.
Optional kann man den Base64 String vorher mit der Build-In Funktion (ntdll.dll) oder mit LZMAT komprimieren, um Platz zu sparen!
Danke an
trancexx für die LZNTCompress / LZNTDecompress und _Base64Decode() Funktionen
Ward für die _Base64Encode() / LZMAT und MsgBoxEx() Funktionen
wraithdu für die Beseitung und Erweiterung des Codes
Tipp: für größere Dateien würde ich die Kompression auf Standard setzen, damit die Kompression schneller geht -> rechte Maustaste auf das Label Compression -> Compression Strength -> Standard
Die Bedienung sollte selbsterklärend sein.
Download: File to Base64 String Code Generator v1.20 Build 2020-06-05 (AutoIt Version 3.3.13.19 oder höher benötigt!)
Source Code auf Pastebin.com
Für Anwendungsbeispiele siehe Post#6.
Über Kritik würde ich mich wie immer freuen. ![]()
Gruß,
UEZ
Historie:
2011-10-29: kleine Änderungen an der GUI + schnelleres Erstellen des Binär Strings
2011-10-30: Code auf Base64 umgestellt + DEP Check + Bugs gefixt
2011-10-31: noch ein Bug gefixt (Absturz bei 0 Kb Dateien) + Modifikationen an dem GUI Code
2011-11-01: und wieder ein Bug gefunden (leere Inhalt konnte gespeichert werden)
2011-11-11: Multi File Auswahl hinzugefügt
2011-11-12: Funktionsnamen Bug beseitigt (danke Oscar!)
2011-11-14: kleine Modifikationen am Code
2011-11-15: Version 1.0 veröffentlicht und Name geändert
2011-11-16: Komprimierung wird nun automatisch abgeschaltet, wenn die komprimierte Größe größer als die Original Größe ist. Farben können nun über die Ini Datei gesteuert werden
2011-11-17: Credits Funktion hinzugefügt
2011-11-21: ein Sleep(50) in eine Schleife hinzugefügt, da ansonsten die CPU unnötig schwitzt
2012-01-14: Funktion Load_BMP_From_Mem() aktualisiert
2012-04-11: kleinere Bugs in Funktion Load_BMP_From_Mem() Funktion gefixed und Funktion hinzugefügt den generierten Code direkt in SciTE einzufügen
2012-04-17: Popup Menu hinzugefügt, damit man u.a. den selektierten Bereich in die Zwischenablage kopieren kann
2012-04-24: Kompressionseinstellung wird jetzt auch in der Ini Datei gespeichert
2012-05-02: Drag'n'Drop von Files auf die GUI hinzugefügt + Kompressionseinstellung wird auch in der Ini Datei gespeichert
2012-05-03: Ordner konnten auch per Drag'n'Drop auf die GUI hinzugefügt -> fixed
2012-05-18: Kopieren des generierten Codes in das Clipboard mit RMB im Editfeld + Kompressionsstatistik kann jetzt wieder angezeigt werden, wenn Label Multiselect mit der LMT gedrückt wird + Code zum Speichern des Binärstrings hinzugefügt
2012-05-31: Fehler in der Drag'n'Drop Funktion behoben
2012-07-23: einige interne Modifikationen
2012-08-29: Bug gefixt in der Multi Selektion Kompression. Binär String wurde nicht komprimiert übergeben, somit war der Binärstring unbrauchbar!
2012-10-12: Drag'n'Drap von einem Ordner war möglich -> ist jetzt gefixt
2012-10-13: "New Length" Wert wurde nicht gelöscht, wenn die Kompression nicht aktiviert wurde
2013-02-19: Buffersize als Aufrufparameter für die Funktion _WinAPI_LZNTDecompress() hinzugefügt.
2013-03-25: Option für die Pfadangabe in generierter Code Funktion hinzugefügt und @LF durch @CRLF ersetzt, kritischen Fehler behoben
2014-05-01: LZMAT Kompression hinzugefügt + einige interne Modifikationen
2014-05-30: Statistik Werte wurden den Umständen falsch angezeigt
2014-06-01: einige Fehler in der Checkbox Logik behoben, was dazu führen konnte, dass der Base64 String nicht zur Entpackfunktion passt
2014-06-05: kleine optische Änderungen
2014-08-01: einige Bugs wurden von wraithdu bezüglich LZMT Dekompression in x64 Modus und noch andere Code Segmente gefixt.
2014-08-02: Option hinzugefügt, um kontinuierliche Funktion Namen zu erzeugen, wenn Multi-Dateien ausgewählt werden, um Funktionen einfach innerhalb Skript behandeln - danke an Oscar für die Idee!
2014-11-05: Bug gefixt, wenn LZMAT selektiert wurde, war LZNT immer noch selektiert.
2014-11-11: hatte vergessen in der ASM_DecompressLZMAT Funktion einige Variable zu deklarieren, was bei Benutzung von AutoItSetOption("MustDeclareVars", 1) zu Fehlern führt
2015-01-20: Output Source Code ein wenig modifiziert
2020-06-05: Code aktualisiert, damit der Code mit der neusten AutoIt Version sauber läuft. Keine neuen Features hinzugefügt!
"This is not a bug - this is a feature".
Ne, mal im Ernst. Folgende Werte werden für _GDIPlus_GraphicsSetInterpolationMode() gesetzt:
Low = 5
Medium = 0
Hight = 7
; |0 - Default interpolation mode
; |1 - Low-quality mode
; |2 - High-quality mode
; |3 - Bilinear interpolation. No prefiltering is done
; |4 - Bicubic interpolation. No prefiltering is done
; |5 - Nearest-neighbor interpolation
; |6 - High-quality, bilinear interpolation. Prefiltering is performed to ensure high-quality shrinking
; |7 - High-quality, bicubic interpolation. Prefiltering is performed to ensure high-quality shrinking
Beim Zoomen wird das Bild entsprechend interpoliert, so dass der Eindruck entsteht, dass die Pixels verschwommen sind. Bei der normalen Ansicht sieht das Bild besser aus, wenn die Interpolation eingeschaltet ist.
Btw, hat jemand eine Idee, wie ich herausfinden kann, ob ein Control ein Scrollbalken hat? Z.B. die AutoIt Hilfe -> das rechte Fenster!
Gruß,
UEZ
Ich habe auch vor langer Zeit einige L-Systeme implementiert: GDI+ Beispiele (#05 - L-System Fraktale)
Da der Code relativ alt ist, kann es sein, dass man ihn anpassen muss, damit er sauber läuft. Hier die Version, das mit der aktuellen Version läuft:
;coded by UEZ 2009-01-17
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
#AutoIt3Wrapper_UseUpx=n
;~ #AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
#AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%"
#AutoIt3Wrapper_Run_After=del "%scriptdir%\%scriptfile%_Obfuscated.au3"
#include <Array.au3>
#include <GDIPlus.au3>
#Include <Misc.au3>
Opt('MustDeclareVars', 1)
Opt("GUIOnEventMode", 1)
Global $dll = DllOpen("user32.dll")
Global Const $Pi = 4 * ATan(1)
Global Const $Pi_Div_180 = $Pi / 180
Global Const $width = 800
Global Const $height = 600
Global $hGUI, $hWnd, $hGraphic, $Bitmap, $Pen
Global $angle = 0, $x1, $y1, $x2, $y2, $random
Global $length, $depth, $dir, $degree, $dist_rel
Global $font_size, $String_Format, $Font_Family, $Font, $Text_Layout, $Brush, $text
$hGUI = GUICreate("GDI+: L-System Fractals by UEZ 2009 (press F9 to save current image)", $width, $height)
GUISetState(@SW_SHOW)
GUISetOnEvent(-3, "_Exit")
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup ()
$hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
$Pen = _GDIPlus_PenCreate(0, 1)
_GDIPlus_GraphicsSetSmoothingMode($hGraphic, 2) ; AntiAlias
$font_size = 7
$String_Format = _GDIPlus_StringFormatCreate ()
$Font_Family = _GDIPlus_FontFamilyCreate ("Arial")
$Font = _GDIPlus_FontCreate ($Font_Family, $font_size, 2)
$Brush = _GDIPlus_BrushCreateSolid (0xDF000000) ;text color
_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
[/autoit] [autoit][/autoit] [autoit]$random = Random(1, 11, 1)
[/autoit] [autoit][/autoit] [autoit]AdlibRegister("Save_PIC", 50)
[/autoit] [autoit][/autoit] [autoit]While 1
Switch $random
Case 1 ;Dragon Curve
$x1 = $width / 4.2
$y1 = $height / 2.8
$length = 500
$depth = Random(6, 18, 1)
$dir = 1
$angle = 0
$text = "Dragon Curve, Recursion Depth = " & $depth
Draw_Text()
Dragon($length, $depth, $dir)
Case 2 ;Levy-C Curve
$x1 = $width / 3.65
$y1 = $height / 2.875
$length = 475
$depth = Random(6, 18, 1)
$dir = 1
$angle = 0
$text = "Levy-C Curve, Recursion Depth = " & $depth
Draw_Text()
Levy_C($length, $depth, $dir)
Case 3 ;Koch Curve
$x1 = $width / 5.3
$y1 = $height / 1.35
$x2 = ""
$y2 = ""
$length = 500
$depth = Random(2, 8, 1)
$dir = 1
$angle = 0
$text = "Koch Curve, Recursion Depth = " & $depth
Draw_Text()
Koch($length, $depth, $dir) ;F
Turn(-$dir * 2 * $degree) ;--
Koch($length, $depth, $dir) ;F
Turn(-$dir * 2 * $degree) ;--
Koch($length, $depth, $dir) ;F
Case 4 ;Peano Curve
$x1 = $width / 8
$y1 = $height / 2
$length = 600
$depth = Random(2, 5, 1)
$dir = 1
$angle = 0
$text = "Peano Curve, Recursion Depth = " & $depth
Draw_Text()
Peano($length, $depth, $dir)
Case 5 ;Triangle
$x1 = $width / 10.8
$y1 = $height / 1.03
$length = 1300
$depth = Random(2, 10, 1)
$dir = 1
$angle = 0
$text = "Triangle, Recursion Depth = " & $depth
Draw_Text()
Triangle($length, $depth, $dir)
Case 6 ;Arrowhead Curve
$x1 = $width / 10.80
$y1 = $height / 1.05
$length = 650
$depth = Random(3, 9, 1)
$dir = 1
$angle = 0
$text = "Arrowhead Curve, Recursion Depth = " & $depth
Draw_Text()
Arrowhead_R($length, $depth, $dir) ;R
Case 7 ;Penta Plexity
$x1 = $width / 3.55
$y1 = $height / 15
$length = 350
$depth = Random(1, 6, 1)
$dir = 1
$angle = 0
$text = "Penta Plexity, Recursion Depth = " & $depth
Draw_Text()
;F++F++F++F++F
Penta_Plexity($length, $depth, $dir) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length, $depth, $dir) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length, $depth, $dir) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length, $depth, $dir) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length, $depth, $dir) ;F
Case 8 ;Sierpinski Carpet
$x1 = $width / 8
$y1 = $height / 2
$length = 600
$depth = Random(2, 6, 1)
$dir = 1
$angle = 0
$text = "Sierpinski Carpet, Recursion Depth = " & $depth
Draw_Text()
Sierpinski_Carpet($length, $depth, $dir) ;F
Case 9 ;Gosper Curve
$depth = Random(4, 6, 1)
$x1 = $width / 1.45
$y1 = $height / 7 - $depth
$length = 480
$dir = 1
$angle = 0
$text = "Gosper Curve, Recursion Depth = " & $depth
Draw_Text()
Gosper_R($length, $depth, $dir) ;R
Case 10 ;Sierpinski Triangle
$x1 = $width / 10.666
$y1 = $height / 1.05
$length = 325
$depth = Random(2, 9, 1)
$dir = 1
$angle = 0
$text = "Sierpinski Triangle, Recursion Depth = " & $depth
Draw_Text()
;FXF--FF--FF
Sierpinski_F($length, $depth, $dir) ;F
Sierpinski_X($length, $depth, $dir) ;X
Sierpinski_F($length, $depth, $dir) ;F
Turn(-$dir * 2 * $degree) ;--
Sierpinski_F($length, $depth, $dir) ;F
Sierpinski_F($length, $depth, $dir) ;F
Turn(-$dir * 2 * $degree) ;--
Sierpinski_F($length, $depth, $dir) ;F
Sierpinski_F($length, $depth, $dir) ;F
Case 11 ;Pythagoras Tree
$x1 = $width / 2
$y1 = $height / 1.1
$length = 110
$depth = Random(5, 15, 1)
$dir = 1
$angle = 5
$text = "Pythagoras Tree, Recursion Depth = " & $depth
Draw_Text()
Pythagoras($length, $depth, $dir)
EndSwitch
$random += 1
If $random = 12 Then $random = 1
Sleep(4000)
_GDIPlus_GraphicsClear($hGraphic, 0xFFFFFFFF)
Wend
Func Pythagoras($length, $split, $dir)
[/autoit] [autoit][/autoit] [autoit]If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Pythagoras_Square($length)
Else
$dist_rel = Sqrt(3) / 2
$degree = 30
Pythagoras_Square($length)
Forward_Only($length)
Turn(-$dir * 1 * $degree)
Pythagoras($length * $dist_rel, $split - 1, 1)
Turn($dir * 3 * $degree)
Forward_Only($length * $dist_rel)
Pythagoras($length / 2, $split - 1, 1)
Forward_Only(-$length * $dist_rel)
Turn(-$dir * 2 * $degree)
Forward_Only(-$length)
EndIf
;Sleep(0)
EndFunc
Func Pythagoras_Square($length)
Local $i
For $i = 1 To 4
Draw_and_Forward($length)
Turn($dir * 90)
Next
EndFunc
Func Sierpinski_X($length, $split, $dir)
;FXF--FF--FF
;X -> --FXF++FXF++FXF--
;F -> FF
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
;~ Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Turn(-$dir * 2 * $degree) ;--
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_X($length / $dist_rel, $split - 1, 1) ;X
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_X($length / $dist_rel, $split - 1, 1) ;X
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_X($length / $dist_rel, $split - 1, 1) ;X
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
EndIf
;Sleep(0)
EndFunc
Func Sierpinski_F($length, $split, $dir)
;FXF--FF--FF
;X -> --FXF++FXF++FXF--
;F -> FF
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_F($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Gosper_R($length, $split, $dir)
;F -> R or F -> L
;R -> R+L++L-R--RR-L+
;L -> -R+LL++L+R--R-L
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = Sqrt(7)
$degree = 60
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn($dir * 1 * $degree) ;+
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 2 * $degree) ;++
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn(-$dir * 1 * $degree) ;-
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 2 * $degree) ;--
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 1 * $degree) ;-
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 1 * $degree) ;+
EndIf
;Sleep(0)
EndFunc
Func Gosper_L($length, $split, $dir)
;F -> R or F -> L
;R -> R+L++L-R--RR-L+
;L -> -R+LL++L+R--R-L
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = Sqrt(7)
$degree = 60
Turn(-$dir * 1 * $degree) ;-
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn($dir * 1 * $degree) ;+
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 2 * $degree) ;++
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 1 * $degree) ;+
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 2 * $degree) ;--
Gosper_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 1 * $degree) ;-
Gosper_L($length / $dist_rel, $split - 1, 1) ;L
EndIf
;Sleep(0)
EndFunc
Func Sierpinski_Carpet($length, $split, $dir)
;F
;F -> F+F-F-FF-F-F-fF
;f -> fff
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 3
$degree = 90
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 1 * $degree) ;+
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Sierpinski_Carpet_Forward_Only($length / $dist_rel, $split - 1, 1) ;f
Sierpinski_Carpet($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Sierpinski_Carpet_Forward_Only($length, $split, $dir) ;f
;F
;F -> F+F-F-FF-F-F-fF
;f -> fff
Forward_Only($length / $dist_rel) ;f
Forward_Only($length / $dist_rel) ;f
Forward_Only($length / $dist_rel) ;f
;Sleep(0)
EndFunc
Func Penta_Plexity($length, $split, $dir)
;F++F++F++F++F
;F -> F++F++F|F-F++F
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = ((Sqrt(5) + 1) / 2)^2
$degree = 36
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 5 * $degree) ;180°
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 1 * $degree) ;-
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * 2 * $degree) ;++
Penta_Plexity($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Arrowhead_R($length, $split, $dir)
;F -> R oder F -> L
;R -> -L+R+L-
;L -> +R-L-R+
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Turn(-$dir * 1 * $degree) ;-
Arrowhead_L($length / $dist_rel, $split - 1, 1) ;L
Turn($dir * 1 * $degree) ;+
Arrowhead_R($length / $dist_rel, $split - 1, 1) ;R
Turn($dir * 1 * $degree) ;+
Arrowhead_L($length / $dist_rel, $split - 1, 1) ;L
Turn(-$dir * 1 * $degree) ;--
EndIf
;Sleep(0)
EndFunc
Func Arrowhead_L($length, $split, $dir)
;F -> R oder F -> L
;R -> -L+R+L-
;L -> +R-L-R+
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Turn($dir * 1 * $degree) ;+
Arrowhead_R($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 1 * $degree) ;-
Arrowhead_L($length / $dist_rel, $split - 1, 1) ;L
Turn(-$dir * 1 * $degree) ;-
Arrowhead_R($length / $dist_rel, $split - 1, 1) ;R
Turn($dir * 1 * $degree) ;+
EndIf
;Sleep(0)
EndFunc
Func Triangle($length, $split, $dir)
;F--F--F
;F -> F--F--F--ff
;ff -> ff
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 2
$degree = 60
Triangle($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Triangle($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Triangle($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Forward_Only($length / $dist_rel) ;f
Forward_Only($length / $dist_rel) ;f
EndIf
;Sleep(0)
EndFunc
Func Dragon($length, $split, $dir)
;F -> R
;R -> +R--L+
;L -> -R++L-
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$degree = 45
$dist_rel = Sqrt(2)
Turn($dir * $degree) ;+
Dragon($length / $dist_rel, $split - 1, 1) ;R
Turn(-$dir * 2 * $degree) ;--
Dragon($length / $dist_rel, $split - 1, -1) ;L
Turn($dir * $degree) ;+
EndIf
;Sleep(0)
EndFunc
Func Levy_C($length, $split, $dir)
;F
;F -> +F--F+
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$degree = 45
$dist_rel = 1.45
Turn($dir * $degree) ;+
Levy_C($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Levy_C($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
EndIf
;Sleep(0)
EndFunc
Func Koch($length, $split, $dir)
;F--F--F
;F -> F+F--F+F
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 3
$degree = 60
Koch($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Koch($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * 2 * $degree) ;--
Koch($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Koch($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Peano($length, $split, $dir)
;F
;F -> F-F+F+F+F-F-F-F+F
If _IsPressed("20", $dll) Then ;hold pressed spacebar to abort current drawing
$split = 0
$dir = 0
$length = 0
EndIf
If $split = 0 Then
Draw_and_Forward($length)
Else
$dist_rel = 3
$degree = 90
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * $degree) ;-
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * $degree) ;-
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * $degree) ;-
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn(-$dir * $degree) ;-
Peano($length / $dist_rel, $split - 1, 1) ;F
Turn($dir * $degree) ;+
Peano($length / $dist_rel, $split - 1, 1) ;F
EndIf
;Sleep(0)
EndFunc
Func Turn ($degrees)
$angle = $angle + ($degrees * $Pi_Div_180)
EndFunc
Func Draw_and_Forward($length)
$x2 = $x1 + Cos($angle) * $length
$y2 = $y1 + Sin($angle) * $length
;~ Local $red = ((Cos(1 * $x1 / 64) + 1) / 2) * 256
;~ Local $green = ((Cos(1.25 * $y2 / 64) + 1) / 2) * 256
;~ Local $blue = ((Cos(1.5 * $x2 / 64) + 1) / 2) * 256
;~ _GDIPlus_PenSetColor($Pen, "0xEF" & Hex($red, 2) & Hex($green, 2) & Hex($blue, 2)) ;Set the pen color
_GDIPlus_PenSetColor($Pen, "0x68000000") ;Set the pen color
_GDIPlus_GraphicsDrawLine($hGraphic, $x1, $y1, $x2, $y2, $Pen)
$x1 = $x2
$y1 = $y2
EndFunc
Func Forward_Only($length)
$x2 = $x1 + Cos($angle) * $length
$y2 = $y1 + Sin($angle) * $length
$x1 = $x2
$y1 = $y2
EndFunc
Func Draw_Text()
Local $Text_Layout2
Local $text_info = "UEZ 2009 ;-)"
$Text_Layout = _GDIPlus_RectFCreate (0, $height - 1.75 * $font_size, 0, 0)
$Text_Layout2 = _GDIPlus_RectFCreate ($width - StringLen($text_info) * $font_size * 0.67, $height - 1.75 * $font_size, 0, 0)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, $text, $Font, $Text_Layout, $String_Format, $Brush)
_GDIPlus_GraphicsDrawStringEx ($hGraphic, $text_info, $Font, $Text_Layout2, $String_Format, $Brush)
EndFunc
Func Save_PIC()
If _IsPressed("78", $dll) Then
_GDIPlus_Save_to_Image(@ScriptDir & "\L-SF-Screenshot_" & @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC, $hGUI)
If @error Then MsgBox(16, "ERROR", "Image was not saved!", 10)
EndIf
EndFunc
; #FUNCTION# =============================================================================
; Name.............: _GDIPlus_Save_to_Image
; Description ...: INTERNAL FUNCTION - save drawn elements in GUI to file
; Syntax...........: _GDIPlus_Save_to_Image($file, $hWnd)
; Parameters ...: $file - filename
; $hWnd - handle to GUI
; Author .........: ptrex, ProgAndy, UEZ
; =========================================================================================
Func _GDIPlus_Save_to_Image($file, $hWnd)
Local $hDC, $memBmp, $memDC, $hImage, $w, $h, $size, $err, $sCLSID, $ext, $fExt
If $file <> "" Or $hWnd <> "" Then
$size = WinGetClientSize($hWnd)
$w = $size[0]
$h = $size[1]
$hDC = _WinAPI_GetDC($hWnd)
$memDC = _WinAPI_CreateCompatibleDC($hDC)
$memBmp = _WinAPI_CreateCompatibleBitmap($hDC, $w, $h)
_WinAPI_SelectObject ($memDC, $memBmp)
_WinAPI_BitBlt($memDC, 0, 0, $w, $h, $hDC, 0, 0, 0x00CC0020) ; 0x00CC0020 = $SRCCOPY
$hImage = _GDIPlus_BitmapCreateFromHBITMAP ($memBmp)
$ext = "png,bmp,jpg,tif,gif"
$fExt = StringRight($file, 3)
If Not StringInStr($ext, $fExt) Then
$CLSID = "PNG"
$file &= ".png"
Else
$CLSID = $fExt
EndIf
$sCLSID = _GDIPlus_EncodersGetCLSID ($CLSID)
If Not _GDIPlus_ImageSaveToFileEx ($hImage, $file, $sCLSID) Then $err = 1
_GDIPlus_ImageDispose ($hImage)
_WinAPI_ReleaseDC($hWnd, $hDC)
_WinAPI_DeleteDC($memDC)
_WinAPI_DeleteObject ($memBmp)
If $err Then Return SetError(2, 0, 0)
Return SetError(0, 0, 0)
Else
Return SetError(1, 0, 0)
EndIf
EndFunc
Func _Exit()
AdlibUnRegister("Save_PIC")
; Clean up resources
_GDIPlus_PenDispose($Pen)
_GDIPlus_GraphicsDispose ($hGraphic)
_GDIPlus_FontDispose ($Font)
_GDIPlus_FontFamilyDispose ($Font_Family)
_GDIPlus_StringFormatDispose ($String_Format)
_GDIPlus_BrushDispose($Brush)
_GDIPlus_Shutdown ()
DllClose($dll)
Exit
EndFunc
Gruß,
UEZ
Da es viele Zeilen Code sind, ist es relativ unübersichtlich geworden. Aber ob man den Code nachvollziehen kann, kann ich nicht beurteilen, da auch kaum Kommentare vorhanden sind. ![]()
Nichts ist unmöglich, na ja sagen wir mal fast ist nichts unmöglich... Wenn ich das alter Sack hinbekomme, dann sollten die Jungspunde das alle mal hinbekommen.
Danke nochmals für dein Feedback!
Gruß,
UEZ
Aha. Dort habe ich auch nicht die 1.40'er Version angekündigt.
Hier ist das Feedback eher bescheiden, darum gibt es meistens das Update eher auf der engl. Seite.
Benutzt du auch das Programm? Denn es scheint so, als ob du der Einzige bist, der das Programm zu benutzen scheint. ![]()
Gruß,
UEZ
Bitte! Freut mich, dass es dir gefällt!
Mehr konnte ich nicht optimieren.
Wie hast du vom Update erfahren?
Gruß,
UEZ
Hier eine andere Variante:
[autoit]
$string = "5,49 €"
ConsoleWrite(StringRegExpReplace($string, "(.*)\h.*", "$1") & @CRLF)
$string = "1,25 €"
ConsoleWrite(StringRegExpReplace($string, "(.*)\h.*", "$1") & @CRLF)
$string = "Kostenlos"
ConsoleWrite(StringRegExpReplace($string, "(.*)\h.*", "$1") & @CRLF)
Gruß,
UEZ
Welchen Ordnernamen willst du genau haben?`
Gruß,
UEZ
Probiere mal
[autoit]
$name = StringRegExpReplace($path, "^.*\\(.*)$", "$1")
Gruß,
UEZ
Das kommt drauf an. Bei mir passt es ziemlich genau, auch wenn die Maus hakt.
Du kannst und solltest immer noch _ScreenCapture_Capture zerpflücken, das war mir zu viel AufwandWenn du es richtig machst, kannst du dann nämlich auch das letzte DeleteObject aus der Schleife entfernen, es werden dann nur noch Bilddaten ziwschen schon reservierten Speicherbereichen kopiert das sollte schneller sein ohne ein andauerndes CreateCompatibleBitmap / DeleteObject
Mehr geht glaube ich nicht, außer der WTOB() Funktion:
Func Grab2AVI()
GUISetState(@SW_HIDE, $hGUI)
Local $hGUI_Grab2AVI = GUICreate("", 0, 0, 0, 0, $WS_POPUP, $WS_EX_TOPMOST + $WS_EX_TOOLWINDOW, WinGetHandle(AutoItWinGetTitle()))
GUISetBkColor(0xFF0000, $hGUI_Grab2AVI)
GUISetState(@SW_SHOW, $hGUI_Grab2AVI)
Local $aMPos, $hWin, $hWinAncestor, $hWnd, $aRet_prev, $aPos, $q, $fps, $hBmp_AVI
Local Const $frame_size = 3
Local $tPoint = DllStructCreate($tagPOINT)
Local $esc = True
While Not _IsPressed("1B", $dll) * Sleep(25)
$aMPos = MouseGetPos()
DllStructSetData($tPoint, 1, $aMPos[0])
DllStructSetData($tPoint, 2, $aMPos[1])
$hWin = _WinAPI_WindowFromPoint($tPoint)
$hWinAncestor = _WinAPI_GetAncestor($hWin, 2)
$hWnd = HWnd($hWinAncestor)
$aRet_prev = -1
$aPos = WinGetPos($hWnd)
If $hWnd <> $hGUI_Grab2AVI And $hWnd <> $aRet_prev Then
$aRet_prev = $hWnd
WinMove($hGUI_Grab2AVI, "", $aPos[0], $aPos[1], $aPos[2], $aPos[3], 1)
_GuiHole($hGUI_Grab2AVI, $frame_size, $frame_size, $aPos[2] - 2 * $frame_size, $aPos[3] - 2 * $frame_size, $aPos[2], $aPos[3])
WinSetOnTop($hGUI_Grab2AVI, 0, 1)
ToolTip("Press CTRL to start capturing of marked window!" & @LF & @LF & _
"Windows Size: " & $aPos[2] & " x " & $aPos[3], $aMPos[0] + 10, $aMPos[1] + 10)
EndIf
If _IsPressed("11", $dll) Then
$esc = False
ExitLoop
EndIf
WEnd
ToolTip("")
$tPoint = 0
If Not $esc Then
For $q = 0 To UBound($aButton_Menu_AVI_Sub1_Item) - 1
If BitAND(GUICtrlRead($aButton_Menu_AVI_Sub1_Item[$q]), $GUI_CHECKED) = $GUI_CHECKED Then
$rec_time = $AVI_ReqTime[$q]
ExitLoop
EndIf
Next
For $q = 0 To UBound($aButton_Menu_AVI_Sub2_Item) - 1
If BitAND(GUICtrlRead($aButton_Menu_AVI_Sub2_Item[$q]), $GUI_CHECKED) = $GUI_CHECKED Then
$fps = $AVI_FPS[$q]
ExitLoop
EndIf
Next
EndIf
GUIDelete($hGUI_Grab2AVI)
If $esc Then Return GUISetState(@SW_SHOW, $hGUI)
Local $timestamp = @YEAR & @MON & @MDAY & "_" & @HOUR & @MIN & @SEC & "_"
Local $WinTitle = StringRegExpReplace(WinGetTitle($hWnd), '(\?|\*|\<|\>|\"|\:|\\)', "")
Local $add_ts = False
If BitAND(GUICtrlRead($mButton_Menu_AVI_Sub3_Item1), $GUI_CHECKED) = $GUI_CHECKED Then $add_ts = True
If BitAND(GUICtrlRead($mButton_Menu_AVI_Sub4_Item2), $GUI_CHECKED) = $GUI_CHECKED Then
$compress_avi = False
Else
$compress_avi = True
EndIf
_StartAviLibrary()
Local $AVI_Filename = @ScriptDir & "\" & $timestamp & $WinTitle & ".avi"
Local $AVI_File = _CreateAvi($AVI_Filename, $fps, $aPos[2], $aPos[3])
If @error Then
_CloseAvi($AVI_File)
_StopAviLibrary()
FileDelete($AVI_Filename)
GUISetState(@SW_SHOW, $hGUI)
Return MsgBox(64 + 262144, "Information", "Grab Screen to AVI has been aborted!", 15, $hGUI)
EndIf
Local $hBitmap_AVI, $hBitmap_AVI_TS, $hBmp_AVI_TS, $OldBMP
Local $total_FPS = $rec_time * $fps, $fps_c = 1
Local $fc = 1000 / $fps
Local $k32_dll = DllOpen("kernel32.dll")
Local $g32_dll = DllOpen("gdi32.dll")
Local $DC = _WinAPI_GetDC(0)
Local $hDC = _WinAPI_CreateCompatibleDC($DC)
Local $OldBMP, $bits = DllStructCreate("byte[" & DllStructGetData($AVI_File[3], "biSizeImage") & "]")
Local $pBits = DllStructGetPtr($bits), $iLines = Abs(DllStructGetData($AVI_File[3], "biHeight"))
Local $pHeader = DllStructGetPtr($AVI_File[3]), $iSize = DllStructGetSize($bits)
Local $iLeft, $iRight, $iTop, $iBottom
$iLeft = $aPos[0]
$iRight = $aPos[0] + $aPos[2]
$iTop = $aPos[1]
$iBottom = $aPos[1] + $aPos[3]
If $iRight = -1 Then $iRight = _WinAPI_GetSystemMetrics($__SCREENCAPTURECONSTANT_SM_CXSCREEN)
If $iBottom = -1 Then $iBottom = _WinAPI_GetSystemMetrics($__SCREENCAPTURECONSTANT_SM_CYSCREEN)
Local $iW = $aPos[2]
Local $iH = $aPos[3]
$hBmp_AVI = _WinAPI_CreateCompatibleBitmap($DC, $iW, $iH)
Local $rec_timer = TimerInit()
If $add_ts Then
Do
$OldBMP = DllCall($g32_dll, "handle", "SelectObject", "handle", $hDC, "handle", $hBmp_AVI)
DllCall($g32_dll, "bool", "BitBlt", "handle", $hDC, "int", 0, "int", 0, "int", $iW, "int", $iH, "handle", $DC, "int", $iLeft, "int", $iTop, "dword", $SRCCOPY) ;_WinAPI_BitBlt()
$hBitmap_AVI = DllCall($ghGDIPDll, "int", "GdipCreateBitmapFromHBITMAP", "handle", $hBmp_AVI, "handle", 0, "ptr*", 0)
$hBitmap_AVI_TS = WTOB($hBitmap_AVI[3], _Now())
$hBmp_AVI_TS = DllCall($ghGDIPDll, "int", "GdipCreateHBITMAPFromBitmap", "handle", $hBitmap_AVI_TS, "ptr*", 0, "dword", 0xFF000000)
DllCall($g32_dll, "int", "GetDIBits", "handle", $hDC, "handle", $hBmp_AVI_TS[2], "uint", 0, "uint", $iLines, "ptr", $pBits, "ptr", $pHeader, "uint", 0)
DllCall($g32_dll, "handle", "SelectObject", "handle", $hDC, "handle", $OldBMP[0])
DllCall($Avi32_Dll, "int", "AVIStreamWrite", "ptr", $AVI_File[1], "long", $AVI_File[2], "long", 1, "ptr", $pBits, "long", $iSize, "long", $AVIIF_KEYFRAME, "ptr*", 0, "ptr*", 0)
$AVI_File[2] += 1
DllCall ($k32_dll, "none", "Sleep", "dword", $fc)
[/autoit] [autoit][/autoit] [autoit]DllCall($g32_dll, "bool", "DeleteObject", "handle", $hBmp_AVI_TS[2])
DllCall($ghGDIPDll, "int", "GdipDisposeImage", "handle", $hBitmap_AVI[3])
DllCall($ghGDIPDll, "int", "GdipDisposeImage", "handle", $hBitmap_AVI_TS)
$fps_c += 1
Until $fps_c > $total_FPS
Else
Do
;_ScreenCapture_Capture() reduced
$OldBMP = DllCall($g32_dll, "handle", "SelectObject", "handle", $hDC, "handle", $hBmp_AVI) ;_WinAPI_SelectObject()
DllCall($g32_dll, "bool", "BitBlt", "handle", $hDC, "int", 0, "int", 0, "int", $iW, "int", $iH, "handle", $DC, "int", $iLeft, "int", $iTop, "dword", $SRCCOPY) ;_WinAPI_BitBlt()
DllCall($g32_dll, "int", "GetDIBits", "handle", $hDC, "handle", $hBmp_AVI, "uint", 0, "uint", $iLines, "ptr", $pBits, "ptr", $pHeader, "uint", 0) ; _WinAPI_GetDIBits()
DllCall($g32_dll, "handle", "SelectObject", "handle", $hDC, "handle", $OldBMP[0]) ;_WinAPI_SelectObject()
DllCall($Avi32_Dll, "int", "AVIStreamWrite", "ptr", $AVI_File[1], "long", $AVI_File[2], "long", 1, "ptr", $pBits, "long", $iSize, "long", $AVIIF_KEYFRAME, "ptr*", 0, "ptr*", 0)
$AVI_File[2] += 1
DllCall ($k32_dll, "none", "Sleep", "dword", $fc)
[/autoit] [autoit][/autoit] [autoit]$fps_c += 1
Until $fps_c > $total_FPS
EndIf
Local $rec_dur = Round(TimerDiff($rec_timer) / 1000, 2)
_WinAPI_DeleteObject($hBmp_AVI)
_WinAPI_SelectObject($DC, $OldBMP[0])
_WinAPI_ReleaseDC(0, $DC)
_WinAPI_DeleteDC($hDC)
_CloseAvi($AVI_File)
_StopAviLibrary()
DllClose($k32_dll)
DllClose($g32_dll)
MsgBox(64 + 262144, "Information", _
"AVI video successfully created: " & @LF & @LF & _
"Filename: " & $AVI_Filename & @LF & _
"Filesize: " & Round(FileGetSize($AVI_Filename) / 1024^2, 2) & " MB" & @LF & _
"Duration: " & $rec_time & " seconds" & @LF & _
"Frames per second: " & $fps & @LF & _
"Video resolution: " & $aPos[2] & " x " & $aPos[3] & @LF & _
"Record duration: " & $rec_dur & " seconds", 30, $hGUI)
GUISetState(@SW_SHOW, $hGUI)
Local $show_avi = MsgBox(4 + 48 + 256, "Question", "Open AVI with default viewer?", 15, $hGUI)
If $show_avi = 6 Then ShellExecute($AVI_Filename)
EndFunc
Den Text per WinAPI zu schreiben ist schneller, aber nicht leserlicher.
Warum hast du
[autoit]
$t = $fc - TimerDiff($t)
If $t > 0 Then DllCall ($k32_dll, "none", "Sleep", "DWORD", $t)
verwendet? Was bringt das mehr als nur
DllCall ($k32_dll, "none", "Sleep", "dword", $fc)
?
Alter jetzt hab ich alles gesehen...da braucht man mal sowas und in dem moment kommt von irgendwoher die idee hier nachzusehen und *zack* hast du was...da ziehe ich meinen Hut vor dir (sobald ich mal einen anhabe). Sowas geht unter "High LVL Programming", wobei ich natürlich schon sagen muss, das mit die Kommentare im Code fehlen...ich verstehe bis zu 70% des Codes nicht mal ansatzweise, aber das ist Detail und auch ich vergesse ab und zu zu kommentieren...ansonsten wirklich grosse Klasse 5*
Das mit dem Kommentieren ist immer so eine Sache, eigentlich sollte man das immer machen, um nach einigen Wochen den eigenen Code zu verstehen, aber Faulheit siegt meistens...
So kompliziert ist der Code eigentlich doch nicht, nur ziemlich viel in der Zwischenzeit. ![]()
Gruß,
UEZ
Danke für die neue Version.
Leider funktioniert es bei mir nicht vollständig.Ich will 30 Sekunden aufzeichen.
Die Aufzeichnugsphase dauert dann 50 Sekunden.
Während der Aufzeichnung ruckelt die Maus.
Das Videos ist dann 30 Sekunden langBei 10 Sekunden sinds 15 Sekunden
Tja, das ist das Problem bei einer Interpreter Sprache: die Geschwindigkeit.
progandy's version ist etwas schneller, aber letzt endlich gleiches Problem auch hier - Aufzeichnungslänge ist größer als die Solllänge und die Maus hakt.
VIELEN DANK FÜRS TESTEN!!!!
@progandy: danke für die Optimierung! ![]()
Mal sehen, ob man noch mehr heraus holen kann.
Gruß,
UEZ
Hm, gerade ist mir noch was aufgefallen.
Kann es sein, dass die Dauer nicht stimmt.Wenn ich 10 Sekunden einstellen, ist das Video nur 5 Sekunden lang.
Bei 5 Sekunden nur 3 Sekunden.Wenn ich es richtig sehe, läuft das Video einfach zu schnell
Sollte jetzt gefixt sein!
Gruß,
UEZ
Sehr interessante Spielerei und sauber programmiert! ![]()
Grafische Spielereien sind i.d.R. "nur brotlose Kunst" und meistens eher was für's Auge und meistens eher selten zu gebrauchen.
Aber nichts desto trotz finde ich immer wieder klasse, irgend welche grafischen Spielereien zu sehen. Mach weiter so (hast dich sehr gut entwickelt!!!) ![]()
Hauptsache es macht SPPPPPAAAAAAAAASSSSSSSSSSS! ![]()
Gruß,
UEZ
Ist sehr gut geworden und das ohne ext. Hilfe (C++)! ![]()
Eigentlich wollte ich auch eine Funktion dbzgl. basteln, aber ich muss das Rad ja nicht neu erfinden! ![]()
Gruß,
UEZ
Ersetze
[autoit]
$aFilter = StringRegExp($sende1, "\$GPRMC,(.*),E\*7B", 3)
durch
[autoit]
$aFilter = StringRegExp($sende1, "\$GPRMC,(.*,E\*7B)\r", 3)
3 bedeutet: Gibt ein Array mit den globalen Übereinstimmungen zurück (Flag).
Gruß,
UEZ
Probiere es mal damit:
[autoit]
#include "Func_Serial.au3"
#include <String.au3>
;$ourDll = DllOpen(@SystemDir & "\kernel32.dll")
Global Const $ComPort = 4
Global Const $Baudrate = 4800
Global Const $Bits = 8
Global Const $Parity = 0
Global Const $Stop = 0
Global Const $Rts = 0
Local $SendPort = _OpenCOMPort($ComPort, $Baudrate, $Bits, $Parity, $Stop, $Rts)
If $SendPort = -1 Then MsgBox(0, "Fehler", "Der sendende COM-Port konnte nicht geöffnet werden!")
While 1
$sende1=_ReceiveStringWait($SendPort,1000,1000)
$aFilter = StringRegExp($sende1, "\$GPRMC,(.*),E\*7B", 3)
If Not @error Then ConsoleWrite("Sende1 "&$aFilter[0]&@CRLF)
WEnd
_CloseCOMPort($SendPort)
Gruß,
UEZ
Hier ein Ansatz:
#include <Constants.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
HotKeySet("{ESC}", "_Exit")
Opt("GUIOnEventMode", 1)
_GDIPlus_Startup()
;~ Global Const $IMAGE_BITMAP = 0
Global Const $STM_SETIMAGE = 0x0172
Global Const $path = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir")
Global Const $sFile = $path & "\Examples\GUI\msoobe.jpg"
Global Const $hImage = _GDIPlus_ImageLoadFromFile($sFile)
Global Const $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage)
_GDIPlus_ImageDispose($hImage)
Global $iTabs = 9
Global $iEpisoden = 9
Global $Episoden[$iEpisoden] = [25, 25, 24, 25, 25, 24, 22, 23, 14]
Global $aBG[$Episoden[UBound($Episoden) - 2] * $iTabs][2]
Gui()
[/autoit] [autoit][/autoit] [autoit]While 1
Sleep(100)
WEnd
Func Gui()
$kk = 0
$Breite = 462
$Hoehe = 266
$GUI = GUICreate("", $Breite, $Hoehe)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
$idPic = GUICtrlCreatePic("", 2, 22, 458, 242)
GuiCtrlSetState(-1, $GUI_DISABLE)
;~ GUICtrlCreateLabel("", 2, 22, 458, 242) ; anstatt GUICtrlCreatePic
;~ GUICtrlSetBkColor(-1, 0xABCDEF) ; anstatt GUICtrlCreatePic
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateTab(1, 1, $Breite, $Hoehe - 1)
For $i = 1 To $iTabs
GUICtrlCreateTabItem("Staffel " & $i)
For $j = 1 To $Episoden[$i - 1]
$X_Koord = 10
$Y_Koord = $j * 18 + 10
If $j > 13 Then
$X_Koord = 240
$Y_Koord = ($j - 13) * 18 + 10
EndIf
$Laenge = Random(10, 50, 1)
$String = "["
For $k = 1 To $Laenge
$String &= "."
Next
$String &= "]"
$aBG[$kk][0] = GUICtrlCreatePic("", $X_Koord, $Y_Koord)
$aBG[$kk][1] = Create_BgBitmap(StringLen($j & ". " & $String) * 3.4, 14)
_WinAPI_DeleteObject(GUICtrlSendMsg($aBG[$kk][0], $STM_SETIMAGE, $IMAGE_BITMAP, $aBG[$kk][1]))
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlCreateLabel($j & ". " & $String, $X_Koord, $Y_Koord, StringLen($j & ". " & $String) * 3.385, 14)
GUICtrlSetCursor(-1, 0)
GUICtrlSetColor(-1, 0x101010)
GUICtrlSetBkColor(-1, -2)
$kk += 1
Next
Next
GUISetState(@SW_SHOW)
_WinAPI_DeleteObject(GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hBitmap))
_WinAPI_RedrawWindow($GUI)
EndFunc
Func _Exit()
For $kk = 0 To UBound($aBG) - 1
_WinAPI_DeleteObject($aBG[$kk][1])
Next
_WinAPI_DeleteObject($hBitmap)
_GDIPlus_Shutdown()
Exit
EndFunc
Func Create_BgBitmap($iWidth, $iHeight, $iColor = 0x10FFFFFF)
Local Const $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iWidth, "int", $iHeight, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0)
Local Const $hBitmap = $aResult[6]
Local Const $hBrush = _GDIPlus_BrushCreateSolid($iColor)
Local Const $hContext = _GDIPlus_ImageGetGraphicsContext($hBitmap)
_GDIPlus_GraphicsFillRect($hContext, 0, 0, $iWidth, $iHeight, $hBrush)
_GDIPlus_GraphicsDispose($hContext)
_GDIPlus_BrushDispose($hBrush)
Return _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
EndFunc
Ist nicht perfekt, aber kannst ja dran schrauben! ![]()
Gruß,
UEZ