In dem Skript wird ein PNG transparent dargestellt.
Allerdings habe ich noch nicht herausgefunden, wie man auf das Bild z.B. Buttons legen kann. Vielleicht eine 2. GUI transparent drüber legen...
Gruß,
UEZ
In dem Skript wird ein PNG transparent dargestellt.
Allerdings habe ich noch nicht herausgefunden, wie man auf das Bild z.B. Buttons legen kann. Vielleicht eine 2. GUI transparent drüber legen...
Gruß,
UEZ
Ähm ich finde leider nichts in dem genannten beitrag welches von nutzen wäre...
ich denke mal es wäre sinnvoller gleich zu sagen um was es im edeffekt geht :
und zwar möchte ich eine Gui in Form eines X machen und es soll natürlich nur das X zu sehen sein und ich kann mich daran erinnern das transparenz ja nicht funktioniert waäre das also in irgendeine form realisierbar ?
Wie machst du das X? Ein Bild?
Gruß,
UEZ
Schaue dir mal die 2 Links an:
http://msdn.microsoft.com/en-us/library/…28VS.85%29.aspx
http://msdn.microsoft.com/en-us/library/…28VS.85%29.aspx
Es geht um SWbemLocator.ConnectServer Methode, wo man mit iSecurityFlags eine Timeout setzen kann.
iSecurityFlags:
wbemConnectFlagUseMaxWait128 (0x80) => The ConnectServer call is guaranteed to return in 2 minutes or less. Use this flag to prevent your program from hanging indefinitely if the connection cannot be established.
Hatte mit meinem SIC2 ähnliche Probleme, aber ich benutze Multiprozessing, so dass ich dieses Problem nicht mehr habe, da ein Subprozess immer kontrolliert, ob das Hauptprogramm hängt.
Bei Multiprozessen überwacht das Hauptprogramm die Subprozesse...
Gruß,
UEZ
Um nicht die Beta durch Doppeltklick zu starten, einfach den Schlüssel in der Registry ändern!
Vista x32:
HKEY_CLASSES_ROOT\.au3
=> (Standard) -> AutoIt3ScriptBeta auf AutoIt3Script ändern.
Sollte unter WinXP ähnlich sein!
Gruß,
UEZ
Alles anzeigenHallo (XP Pro User)
Mein Test auch bei änderrung!!!
Bei doppelklick!
Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist. Und rechte maustaste Compile Script!
Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist. Es geht beides nur aus SciTE herraus!!!!!!!!!
Also vom aussehen super code ! Nur die beiden sachen sind schlecht und nicht für jeden user verständlich voralledem der !!!!!!!!!!!! Virus arlam !!!!!!!!!
LG Kleiner
Habe ich doch glatt ein Virus programmiert ![]()
Ich benutze den gleichen VS, habe nicht die Fehlermeldungen!
Wenn du die neuste Beta im Beta Verzeichnis hast, wird die au3 mit der Beta aufgerufen und deshalb bekommst du die Fehlermeldung, dass _GDIPlus_BrushSetSolidColor() bereits vorhanden ist, denn die Funktion ist bereits in der Beta integriert!
Irgendwo kann man das so einstellen, dass per Doppeltklick nicht die Beta, sondern die finale Version gestartet wird.
UEZ
UEZ
Ich finde das Script Super.
Sollte die Transparente Version ein Durchsichtiges Fenster zeigen? Wenn ja, funzt es nicht auf Windows 7.
Du bist der GDI-Meister unseres Forums. Auch wenn du dich nicht so siehst. Aber wie heißt es, Bescheidenheit ist eine Zier.
Rotating Letters Transparent läuft bei mir auch unter Win7 x64 sauber!
UEZ
UEZ
das heist für eine farbige linie braucht man _GDIPlus_PenSetColor($pen, $color)
oder?
danke für deine antwort
Mit $pen = _GDIPlus_PenCreate(0xFF000000, 1) erstellst du den Stift und mit _GDIPlus_PenSetColor($pen, $c) kannst du die Farbe jeweils ändern ohne immer wieder ein Stift zu erstellen, das sonst Speicher fressen würde.
UEZ
Das mit transparenz ist auch cool !!!
Hab mal eine Frage wie kann ich eine linie die ich erstellt habe in gdi farbig machen zb. Rot
Bin gerade in einer Autowerkstatt und kann dir kein Beispiel schreiben. Hier ein Skript, das ich kürzlich einem MVP geschrieben habe.
Vielleicht beantwortet es ja deine Frage:
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
Global Const $width = 640
Global Const $height = 480
Global $graphics, $backbuffer, $bitmap, $Pen, $i, $pi_div_180 = 4 * ATan(1) / 180
Global $title = "GDI+ Color Gradient"
[/autoit] [autoit][/autoit] [autoit]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)
$pen = _GDIPlus_PenCreate(0xFF000000, 1)
;you can move this lines below until Do...Until loop to Do...Until loop and make some realtime effects
$r = 0x00
$g = 0x00
$b = 0xFF
$c = "0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
$i = 255 / $width
_GDIPlus_GraphicsClear($backbuffer)
[/autoit] [autoit][/autoit] [autoit]For $x = 0 To $width
_GDIPlus_GraphicsDrawLine($backbuffer, $x, 0, $x, $width, $pen)
_GDIPlus_PenSetColor($pen, $c)
$r += $i
$g += $i
$c = "0xEF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
Next
_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
GUIRegisterMsg(0xF, "MY_PAINT"); Register PAINT-Event 0x000F = $WM_PAINT (WindowsConstants.au3)
GUIRegisterMsg(0x85, "MY_PAINT"); $WM_NCPAINT = 0x0085 (WindowsConstants.au3)Restore after Minimize.
$b = 0
[/autoit] [autoit][/autoit] [autoit]Do
[/autoit] [autoit][/autoit] [autoit]Until False * Not Sleep(30)
[/autoit] [autoit][/autoit] [autoit];Func to redraw on PAINT MSG
Func MY_PAINT($hWnd, $msg, $wParam, $lParam)
; The sequencial order of these two commands is important.
_GDIPlus_GraphicsDrawImage($graphics, $bitmap, 0, 0)
_WinAPI_RedrawWindow($hwnd, "", "", BitOR($RDW_INVALIDATE, $RDW_UPDATENOW, $RDW_FRAME)); , $RDW_ALLCHILDREN
Return $GUI_RUNDEFMSG
EndFunc ;==>MY_PAINT
Func Close()
_GDIPlus_PenDispose($pen)
_GDIPlus_GraphicsDispose($backbuffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_Shutdown()
WinClose($hwnd)
Exit
EndFunc
Es zeichnet einen Farbverlauf in eine GUI inkl. Double Buffering, was aber eigentlich nicht benötigt wird.
Bis später.
UEZ
Also, ich persönlich würde mich nicht als GDI+ Meister, Guru oder wie auch immer bezeichnen! Da kenne ich viiiieeelll bessere Personen, wo ich sage, die sind wahre GDI+ Meister.
Was ich im Prinzip immer mache, sind die GDI+ Grundfunktionen mit ein bissl Mathe zu mischen und das ist eigentlich keine meisterreife Leistung!
Ferner finde die alles um 2D/3D sehr interessant, was aber eine brotlose Kunst ist. Es sei denn, man macht es professionell, aber dazu fehlt mir die Mathematik und die Zeit es zu erlernen!
Der C64 hat mich auch in diese Richtung geprägt...
Danke für das Feedback.
Gruß,
UEZ
Hier ein weiteres, sinnloses Skript:
;coded by UEZ 2009
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <String.au3>
Global Const $width = 640
Global Const $height = 480
Global Const $pi_div_180 = 4 * ATan(1) / 180
Global $graphics, $backbuffer, $bitmap, $Pen, $arrTxt1, $arrTxt2, $fontsize_txt1, $fontsize_txt2
Global $brush_color, $hFamily1, $hFamily2, $hFont1, $hFont2, $hFormat, $tLayout
Global $x1, $x2, $y1, $y2, $a, $b, $c, $r, $g, $b
Global $i = 0, $j = 360, $m = 0, $n = 0
Global $radius_x, $radius_y
Global $title = "GDI+: Rotating Letters by UEZ 2009!"
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)
_GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2)
$fontsize_txt1 = 48
$fontsize_txt2 = 24
$width_mul_045 = $width * 0.45
$height_mul_045 = $height * 0.45
$radius_x1 = ($width_mul_045) * 0.95
$radius_y1 = ($height_mul_045) * 0.95
$radius_x2 = ($width_mul_045) * 0.45
$radius_y2 = ($height_mul_045) * 0.45
$text1 = _StringReverse(" Rotating Letters using GDI+")
$text2 = " By UEZ '09 ;-)"
$arrTxt1 = StringSplit($text1, "")
$arrTxt2 = StringSplit($text2, "")
Dim $arrX1[UBound($arrTxt1)]
Dim $arrY1[UBound($arrTxt1)]
Dim $arrX2[UBound($arrTxt2)]
Dim $arrY2[UBound($arrTxt2)]
Dim $brush1[UBound($arrTxt1)]
Dim $brush2[UBound($arrTxt2)]
$r = 1
$c = (255 / UBound($arrTxt1) - 1) * 2 - 1
$r = 0x80
$g = 0xA0
$b = $c
For $k = 0 To UBound($arrTxt1) - 1
$brush_color = "0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
$brush1[$k] = _GDIPlus_BrushCreateSolid($brush_color)
If $r = 1 Then
$b += $c
Else
$b -= $c
EndIf
If $b >= 255 Then $r = 0
If $b <= $c Then $r = 1
Next
For $k = 0 To (UBound($arrTxt2) - 1)
$brush_color = 0xFF808080
$brush2[$k] = _GDIPlus_BrushCreateSolid($brush_color)
Next
_GDIPlus_BrushSetSolidColor($brush2[0], 0xFFD08020)
_GDIPlus_BrushSetSolidColor($brush2[1], 0xFFFFA060)
_GDIPlus_BrushSetSolidColor($brush2[2], 0xFFD08020)
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily1 = _GDIPlus_FontFamilyCreate("Arial")
$hFamily2 = _GDIPlus_FontFamilyCreate("Comic Sans MS")
$hFont1 = _GDIPlus_FontCreate($hFamily1, $fontsize_txt1, 2)
$hFont2 = _GDIPlus_FontCreate($hFamily2, $fontsize_txt2, 2)
$tLayout = _GDIPlus_RectFCreate(0, 0)
$a = 360 / (UBound($arrTxt1) - 1)
$b = 360 / (UBound($arrTxt2) - 1)
$y = 0
Do
_GDIPlus_GraphicsClear($backbuffer, 0x90000000)
For $x = 1 To UBound($arrTxt1) - 1
$x1 = $width_mul_045 + Cos(($i + $m) * $pi_div_180) * $radius_x1
$y1 = $height_mul_045 + Sin(($i + $m) * $pi_div_180) * $radius_y1 - $fontsize_txt1 / 4
$arrX1[$x] = $x1
$arrY1[$x] = $y1
DllStructSetData($tLayout, "x", $arrX1[$x])
DllStructSetData($tLayout, "y", $arrY1[$x])
_GDIPlus_GraphicsDrawStringEx($backbuffer, $arrTxt1[$x], $hFont1, $tLayout, $hFormat, $brush1[$x])
$m += $a
Next
For $x = 1 To UBound($arrTxt2) - 1
$x2 = $width_mul_045 + Cos(($j + $n) * $pi_div_180) * $radius_x2 * Cos($y * $pi_div_180)
$y2 = $height_mul_045 + Sin(($j + $n) * $pi_div_180) * $radius_y2 - $fontsize_txt2 / 4
$arrX2[$x] = $x2
$arrY2[$x] = $y2
DllStructSetData($tLayout, "x", $arrX2[$x])
DllStructSetData($tLayout, "y", $arrY2[$x])
_GDIPlus_GraphicsDrawStringEx($backbuffer, $arrTxt2[$x], $hFont2, $tLayout, $hFormat, $brush2[$x])
$n += $b
Next
If Mod($y, 2) = 1 Then Array_Rot($brush2, 1)
$y += 1
_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
$i += 1
If $i >= 360 Then
$i = 0
$m = 0
EndIf
$j -= 2
If $j <= 0 Then
$j = 360
$n = 0
EndIf
Until False * Not Sleep(30)
Func Array_Rot(ByRef $arr, $dir = 0) ;0 for left, 1 for right
Local $tmp, $p,$q
If $dir = 0 Then ;left rotation
$tmp = $arr[0]
$q = 0
For $p = 1 To UBound($arr) - 1
$arr[$q] = $arr[$p]
$q += 1
Next
$arr[UBound($arr) - 1] = $tmp
ElseIf $dir = 1 Then ;right rotation
$tmp = $arr[UBound($arr) - 1]
$q = UBound($arr) - 1
For $p = UBound($arr) - 2 To 0 Step - 1
$arr[$q] = $arr[$p]
$q -= 1
Next
$arr[0] = $tmp
EndIf
EndFunc
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
Func Close()
For $x = 0 To UBound($arrTxt1) - 1
_GDIPlus_BrushDispose($brush1[$x])
Next
For $x = 0 To UBound($arrTxt2) - 1
_GDIPlus_BrushDispose($brush2[$x])
Next
_GDIPlus_FontDispose($hFont1)
_GDIPlus_FontDispose($hFont2)
_GDIPlus_FontFamilyDispose($hFamily1)
_GDIPlus_FontFamilyDispose($hFamily2)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_GraphicsDispose($backbuffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_Shutdown()
WinClose($hwnd)
Exit
EndFunc ;==>Close
Transparent Fenster Version (danke an Malkey (einer der wirklichen GDI+ Meister!)):
;coded by UEZ 2009
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Run_Obfuscator=y
#Obfuscator_Parameters=/sf /sv /om /cs=0 /cn=0
;~ #AutoIt3Wrapper_Run_After=upx.exe --best "%out%"
#AutoIt3Wrapper_Run_After=upx.exe --ultra-brute "%out%" ;very slow
#AutoIt3Wrapper_Run_After=del "Rotating Letters Transparent_Obfuscated.au3"
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
#include <String.au3>
Global Const $width = 640
Global Const $height = 480
Global Const $pi_div_180 = 4 * ATan(1) / 180
Global $graphics, $backbuffer, $bitmap, $Pen, $arrTxt1, $arrTxt2, $fontsize_txt1, $fontsize_txt2
Global $brush_color, $hFamily1, $hFamily2, $hFont1, $hFont2, $hFormat, $tLayout
Global $ScreenDc, $dc, $tSize, $pSize, $tSource, $pSource, $tBlend, $pBlend, $tPoint, $pPoint, $gdibitmap
Global $x1, $x2, $y1, $y2, $a, $b, $c, $r, $g, $b
Global $i = 0, $j = 360, $m = 0, $n = 0
Global $radius_x, $radius_y
Global $title = "GDI+: Rotating Letters by UEZ 2009!"
Global Const $MSLLHOOKSTRUCT = $tagPOINT & ";dword mouseData;dword flags;dword time;ulong_ptr dwExtraInfo"
;Register callback
$hKey_Proc = DllCallbackRegister("_Mouse_Proc", "int", "int;ptr;ptr")
$hM_Module = DllCall("kernel32.dll", "hwnd", "GetModuleHandle", "ptr", 0)
$hM_Hook = DllCall("user32.dll", "hwnd", "SetWindowsHookEx", "int", $WH_MOUSE_LL, "ptr", DllCallbackGetPtr($hKey_Proc), "hwnd", $hM_Module[0], "dword", 0)
Opt("GUIOnEventMode", 1)
$hwnd = GUICreate($title, $width, $height, -1, -1, 0, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))
GUISetOnEvent($GUI_EVENT_CLOSE, "Close")
_GDIPlus_Startup()
$graphics = _GDIPlus_GraphicsCreateFromHWND($hwnd)
$bitmap = _GDIPlus_BitmapCreateFromGraphics($width, $height, $graphics)
$backbuffer = _GDIPlus_ImageGetGraphicsContext($bitmap)
_GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2)
$ScreenDc = _WinAPI_GetDC($hWnd)
$gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
$dc = _WinAPI_CreateCompatibleDC($ScreenDc)
_WinAPI_SelectObject($dc, $gdibitmap)
; _WinAPI_UpdateLayeredWindow parameters
$tSize = DllStructCreate($tagSIZE)
$pSize = DllStructGetPtr($tSize)
DllStructSetData($tSize, "X", $width)
DllStructSetData($tSize, "Y", $height)
$tSource = DllStructCreate($tagPOINT)
$pSource = DllStructGetPtr($tSource)
$tBlend = DllStructCreate($tagBLENDFUNCTION)
$pBlend = DllStructGetPtr($tBlend)
Global $alpha = 200
Global $alpha_steps = 5
DllStructSetData($tBlend, "Alpha", $alpha)
DllStructSetData($tBlend, "Format", 1)
$tPoint = DllStructCreate($tagPOINT)
$pPoint = DllStructGetPtr($tPoint)
DllStructSetData($tPoint, "X", 0)
DllStructSetData($tPoint, "Y", 0)
GUISetState()
[/autoit] [autoit][/autoit] [autoit]$fontsize_txt1 = 48
$fontsize_txt2 = 24
$width_mul_045 = $width * 0.45
$height_mul_045 = $height * 0.45
$radius_x1 = ($width_mul_045) * 0.95
$radius_y1 = ($height_mul_045) * 0.95
$radius_x2 = ($width_mul_045) * 0.45
$radius_y2 = ($height_mul_045) * 0.45
$text1 = _StringReverse(" Rotating Letters using GDI+")
$text2 = " By UEZ '09 ;-)"
$arrTxt1 = StringSplit($text1, "")
$arrTxt2 = StringSplit($text2, "")
Dim $arrX1[UBound($arrTxt1)]
Dim $arrY1[UBound($arrTxt1)]
Dim $arrX2[UBound($arrTxt2)]
Dim $arrY2[UBound($arrTxt2)]
Dim $brush1[UBound($arrTxt1)]
Dim $brush2[UBound($arrTxt2)]
$r = 1
$c = (255 / UBound($arrTxt1) - 1) * 2 - 1
$r = 0x80
$g = 0xA0
$b = $c
For $k = 0 To UBound($arrTxt1) - 1
$brush_color = "0xFF" & Hex($r, 2) & Hex($g, 2) & Hex($b, 2)
$brush1[$k] = _GDIPlus_BrushCreateSolid($brush_color)
If $r = 1 Then
$b += $c
Else
$b -= $c
EndIf
If $b >= 255 Then $r = 0
If $b <= $c Then $r = 1
Next
For $k = 0 To (UBound($arrTxt2) - 1)
$brush_color = 0xFF808080
$brush2[$k] = _GDIPlus_BrushCreateSolid($brush_color)
Next
_GDIPlus_BrushSetSolidColor($brush2[0], 0xFFD08020)
_GDIPlus_BrushSetSolidColor($brush2[1], 0xFFFFA060)
_GDIPlus_BrushSetSolidColor($brush2[2], 0xFFD08020)
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily1 = _GDIPlus_FontFamilyCreate("Arial")
$hFamily2 = _GDIPlus_FontFamilyCreate("Comic Sans MS")
$hFont1 = _GDIPlus_FontCreate($hFamily1, $fontsize_txt1, 2)
$hFont2 = _GDIPlus_FontCreate($hFamily2, $fontsize_txt2, 2)
$tLayout = _GDIPlus_RectFCreate(0, 0)
$a = 360 / (UBound($arrTxt1) - 1)
$b = 360 / (UBound($arrTxt2) - 1)
$y = 0
Do
_GDIPlus_GraphicsClear($backbuffer, 0x00000000)
For $x = 1 To UBound($arrTxt1) - 1
$x1 = $width_mul_045 + Cos(($i + $m) * $pi_div_180) * $radius_x1
$y1 = $height_mul_045 + Sin(($i + $m) * $pi_div_180) * $radius_y1 - $fontsize_txt1 / 4
$arrX1[$x] = $x1
$arrY1[$x] = $y1
DllStructSetData($tLayout, "x", $arrX1[$x])
DllStructSetData($tLayout, "y", $arrY1[$x])
_GDIPlus_GraphicsDrawStringEx($backbuffer, $arrTxt1[$x], $hFont1, $tLayout, $hFormat, $brush1[$x])
$m += $a
Next
For $x = 1 To UBound($arrTxt2) - 1
$x2 = $width_mul_045 + Cos(($j + $n) * $pi_div_180) * $radius_x2 * Cos($y * $pi_div_180)
$y2 = $height_mul_045 + Sin(($j + $n) * $pi_div_180) * $radius_y2 - $fontsize_txt2 / 4
$arrX2[$x] = $x2
$arrY2[$x] = $y2
DllStructSetData($tLayout, "x", $arrX2[$x])
DllStructSetData($tLayout, "y", $arrY2[$x])
_GDIPlus_GraphicsDrawStringEx($backbuffer, $arrTxt2[$x], $hFont2, $tLayout, $hFormat, $brush2[$x])
$n += $b
Next
If Mod($y, 2) = 1 Then Array_Rot($brush2, 1)
$y += 1
;~ _GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
[/autoit] [autoit][/autoit] [autoit]$gdibitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($bitmap)
_WinAPI_SelectObject($dc, $gdibitmap)
_WinAPI_UpdateLayeredWindow($hWnd, $ScreenDc, 0, $pSize, $dc, $pSource, 0, $pBlend, 2)
_WinAPI_DeleteObject($gdibitmap)
$i += 1
If $i >= 360 Then
$i = 0
$m = 0
EndIf
$j -= 2
If $j <= 0 Then
$j = 360
$n = 0
EndIf
Until False * Not Sleep(30)
Func Array_Rot(ByRef $arr, $dir = 0) ;0 for left, 1 for right
Local $tmp, $p,$q
If $dir = 0 Then ;left rotation
$tmp = $arr[0]
$q = 0
For $p = 1 To UBound($arr) - 1
$arr[$q] = $arr[$p]
$q += 1
Next
$arr[UBound($arr) - 1] = $tmp
ElseIf $dir = 1 Then ;right rotation
$tmp = $arr[UBound($arr) - 1]
$q = UBound($arr) - 1
For $p = UBound($arr) - 2 To 0 Step - 1
$arr[$q] = $arr[$p]
$q -= 1
Next
$arr[0] = $tmp
EndIf
EndFunc
;http://www.autoitscript.com/forum/index.php?showtopic=81761
Func _Mouse_Proc($nCode, $wParam, $lParam) ;function called for mouse events.. Made by _Kurt
;define local vars
Local $info, $mouseData
If $nCode < 0 Then ;recommended, see http://msdn.microsoft.com/en-us/library/ms644986(VS.85).aspx
$ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], "int", $nCode, "ptr", $wParam, "ptr", $lParam) ;recommended
Return $ret[0]
EndIf
$info = DllStructCreate($MSLLHOOKSTRUCT, $lParam)
$mouseData = DllStructGetData($info, 3)
;Find which event happened
Select
Case $wParam = $WM_MOUSEWHEEL And WinActive($hwnd)
If _WinAPI_HiWord($mouseData) > 0 Then ;wheel up
If $alpha + $alpha_steps <= 512 Then $alpha += $alpha_steps
Switch $alpha
Case 0 To 255
DllStructSetData($tBlend, "Alpha", $alpha)
DllStructSetData($tBlend, "Format", 1)
Case 256 To 512
DllStructSetData($tBlend, "Alpha", $alpha - 256)
DllStructSetData($tBlend, "Format", 0)
EndSwitch
Else ;wheel down
If $alpha - $alpha_steps > 0 Then $alpha -= $alpha_steps
Switch $alpha
Case 0 To 255
DllStructSetData($tBlend, "Alpha", $alpha) ;wheel up
DllStructSetData($tBlend, "Format", 1)
Case 256 To 512
DllStructSetData($tBlend, "Alpha", $alpha - 256) ;wheel up
DllStructSetData($tBlend, "Format", 0)
EndSwitch
EndIf
ConsoleWrite($alpha & @CRLF)
EndSelect
;This is recommended instead of Return 0
$ret = DllCall("user32.dll", "long", "CallNextHookEx", "hwnd", $hM_Hook[0], "int", $nCode, "ptr", $wParam, "ptr", $lParam)
Return $ret[0]
EndFunc ;==>_Mouse_Proc
Func Close()
DllCall("user32.dll", "int", "UnhookWindowsHookEx", "hwnd", $hM_Hook[0])
$hM_Hook[0] = 0
DllCallbackFree($hKey_Proc)
$hKey_Proc = 0
For $x = 0 To UBound($arrTxt1) - 1
_GDIPlus_BrushDispose($brush1[$x])
Next
For $x = 0 To UBound($arrTxt2) - 1
_GDIPlus_BrushDispose($brush2[$x])
Next
_WinAPI_DeleteDC($dc)
_WinAPI_ReleaseDC($hWnd, $ScreenDc)
_GDIPlus_FontDispose($hFont1)
_GDIPlus_FontDispose($hFont2)
_GDIPlus_FontFamilyDispose($hFamily1)
_GDIPlus_FontFamilyDispose($hFamily2)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_GraphicsDispose($backbuffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_Shutdown()
WinClose($hwnd)
Exit
EndFunc ;==>Close
Gruß,
UEZ
PS: falls ihr WinXP benutzt und die Darstellung sehr, sehr langsam ist, dann die Zeile 91: _GDIPlus_GraphicsClear($backbuffer, 0x90000000) durch _GDIPlus_GraphicsClear($backbuffer, 0xFF000000) ersetzen (gilt nur für nicht transparente Version)!!!
Ich habe ein wenig dein Skript umgestaltet!
Ich hoffe, dass ist das, was du willst.
Gruß,
UEZ
Ich verstehe dein Programm nicht so richtig!
Was soll passieren, wenn ich Numpad1,2,3 drücke?
Weiter würde ich die While...WEnd Schleife mit einem Sleep beglücken, damit die CPU nicht zur Heizung wird (es ist zwar kalt, aber...) ![]()
While 1 * Sleep(30)
WEnd
Gruß,
UEZ
Ich hatte mal was ähnliches programmiert:
;Coded by UEZ
#include <WindowsConstants.au3>
#include <StructureConstants.au3>
#include <GUIConstantsEx.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Test", 237, 143)
$Checkbox1 = GUICtrlCreateCheckbox("Convert X", 8, 8, 97, 17)
$Checkbox2 = GUICtrlCreateCheckbox("Convert Y", 8, 40, 97, 17)
$Checkbox3 = GUICtrlCreateCheckbox("Convert Z", 8, 72, 97, 17)
$Input1 = GUICtrlCreateInput("", 105, 8, 121, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Input2 = GUICtrlCreateInput("", 105, 40, 121, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Input3 = GUICtrlCreateInput("", 105, 72, 121, 21)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button1 = GUICtrlCreateButton("Load", 8, 104, 75, 25, 0)
$Button2 = GUICtrlCreateButton("Save", 153, 104, 75, 25, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
Load()
Case $Button2
Save()
Case $Checkbox1
If BitAND(GUICtrlRead($Checkbox1), $GUI_CHECKED) Then
GUICtrlSetState($Input1, $GUI_ENABLE)
Else
GUICtrlSetState($Input1, $GUI_DISABLE)
EndIf
Case $Checkbox2
If BitAND(GUICtrlRead($Checkbox2), $GUI_CHECKED) Then
GUICtrlSetState($Input2, $GUI_ENABLE)
Else
GUICtrlSetState($Input2, $GUI_DISABLE)
EndIf
Case $Checkbox3
If BitAND(GUICtrlRead($Checkbox3), $GUI_CHECKED) Then
GUICtrlSetState($Input3, $GUI_ENABLE)
Else
GUICtrlSetState($Input3, $GUI_DISABLE)
EndIf
EndSwitch
WEnd
Func Save()
Local $ini, $save_file, $filename, $dummy_array
Local $filename_suffix = ".ini"
Local $save_path = @ScriptDir
$filename = ""
$filename = FileSaveDialog("Save Project Request Form", $save_path, "Ini Files (*" & $filename_suffix & ")|All Files(*.*)", 16)
If $filename <> "" Then
$dummy_array = StringSplit($filename, ".")
If UBound($dummy_array) > 0 Then
$filename = $dummy_array[1] & $filename_suffix
Else
$filename = $filename_suffix
EndIf
If Not @error Then
$ini = "[Input Section]" & @CRLF & _
"Convert X=" & GUICtrlRead($Input1) & @CRLF & _
"Convert Y=" & GUICtrlRead($Input2) & @CRLF & _
"Convert Z=" & GUICtrlRead($Input3) & @CRLF & @CRLF & _
"[Checkbox Section]" & @CRLF & _
"Checkbox1=" & GUICtrlRead($Checkbox1) & @CRLF & _
"Checkbox2=" & GUICtrlRead($Checkbox2) & @CRLF & _
"Checkbox3=" & GUICtrlRead($Checkbox3) & @CRLF
FileOpen($filename, 2)
FileWrite($filename, $ini)
FileClose($filename)
EndIf
EndIf
EndFunc ;==>Save
Func Load()
Local $filename, $dummy_array, $line
Local $filename_suffix = ".ini"
Local $load_path = @ScriptDir
$filename = ""
$filename = FileOpenDialog("Load Project Request Form", $load_path, "Ini Files (*" & $filename_suffix & ")|All Files(*.*)", 1)
If $filename <> "" Then
$filename = FileOpen($filename, 0)
If Not @error Then
While 1
$line = FileReadLine($filename)
If @error = -1 Then ExitLoop
If StringInStr($line, "Convert X=") Then GUICtrlSetData($Input1, StringMid($line, StringInStr($line, "=") + 1))
If StringInStr($line, "Convert Y=") Then GUICtrlSetData($Input2, StringMid($line, StringInStr($line, "=") + 1))
If StringInStr($line, "Convert Z=") Then GUICtrlSetData($Input3, StringMid($line, StringInStr($line, "=") + 1))
If StringInStr($line, "Checkbox1=") = True And StringMid($line, StringInStr($line, "=") + 1) = 1 Then
GUICtrlSetState($Checkbox1, $GUI_CHECKED)
GUICtrlSetState($Input1, $GUI_ENABLE)
EndIf
If StringInStr($line, "Checkbox1=") = True And StringMid($line, StringInStr($line, "=") + 1) = 4 Then
GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
GUICtrlSetState($Input1, $GUI_DISABLE)
EndIf
If StringInStr($line, "Checkbox2=") = True And StringMid($line, StringInStr($line, "=") + 1) = 1 Then
GUICtrlSetState($Checkbox2, $GUI_CHECKED)
GUICtrlSetState($Input2, $GUI_ENABLE)
EndIf
If StringInStr($line, "Checkbox2=") = True And StringMid($line, StringInStr($line, "=") + 1) = 4 Then
GUICtrlSetState($Checkbox2, $GUI_UNCHECKED)
GUICtrlSetState($Input2, $GUI_DISABLE)
EndIf
If StringInStr($line, "Checkbox3=") = True And StringMid($line, StringInStr($line, "=") + 1) = 1 Then
GUICtrlSetState($Checkbox3, $GUI_CHECKED)
GUICtrlSetState($Input3, $GUI_ENABLE)
EndIf
If StringInStr($line, "Checkbox3=") = True And StringMid($line, StringInStr($line, "=") + 1) = 4 Then
GUICtrlSetState($Checkbox3, $GUI_UNCHECKED)
GUICtrlSetState($Input3, $GUI_DISABLE)
EndIf
WEnd
FileClose($filename)
EndIf
EndIf
EndFunc ;==>Load
Gruß,
UEZ
Kollisionsabfragen sind nicht trivial!!!
Bei AUTOITEROIDS habe ich um die Objekte Kreise gelegt und die Distanz zwischen den Kreisen gemessen.
Kollision genau dann, wenn Distanz(obj1, obj2) -(r1 +r2) <= 0
Distanz = Mittelpunkt Obj1 - Mittelpunkt Obj2
r1 = Radius vom Objekt 1
r2 = Radius vom Objekt 2
Bei rechtwinkeligen Objekten, die sich nicht drehen, ist die Kollisionsabfrage nicht so komplex!
Gruß,
UEZ
Beispiel:
[autoit]$chk = MsgBox(1, "Test", "Neustarten?")
If $chk = 1 Then
ConsoleWrite("Starte PC neu!" & @CRLF)
Else
ConsoleWrite("Abbruch!" & @CRLF)
EndIf
Gruß,
UEZ
Habe eine ATI Radeon Graka und bisher absolut keine Probleme damit gehabt. Wobei man auch im Blick behalten sollte, daß wir hier über Funktionen reden, die spätestens seit der Release von XP im System sitzen. Bis dato wären da sicher schwerwiegende Fehler aufgefallen....
Glaubst du, das nVidea mit Absicht einen GDI+"Bug" mit dieser Treiberversion gefixt hat?
Ich weiß nicht, woran es wirklich liegt. Ich habe am Wochenende einfach die GDI+ Sachen auf meiner XP Büchse laufen lassen und musste feststellen, dass die Probleme nicht mehr existieren!
Woran das jetzt im Detail liegt, kann ich nicht sagen. Vielleicht ist ja eine Kombination aus Treibern und GDI+ DLLs! Letztendlich gibt es ja die Probleme.
Interessant wäre es mal zu testen, ob mit anderen Programmierensprachen (z.B. VB) und GDI+ auf XP Kisten der selbe Fehler auftritt!
Ich glaube nicht, dass nVidia weiß, dass es solche Probleme mit GDI+ unter XP gibt, zumal das Problem auch auf AMD/ATI Grafikkarten existiert.
Wer Probleme auf XP mit _GDIPlus_GraphicsClear($backbuffer, 0x90000000) hat, einfach den Wert auf FF ändern -> _GDIPlus_GraphicsClear($backbuffer, 0xFF000000).
Gruß,
UEZ
wenn ich das script so starte, gibts das altbekannte geflacker und die buchstaben bewegen sich nicht
ändere ich in zeile 58 aber in _GDIPlus_GraphicsClear($backbuffer, 0xff900000) gehts wunderbar....
Nach der Aktualisierung der nVidia Grafiktreiber auf v6.14.11.8618 (10.06.2009) laufen die GDI+ Codes sauber unter WinXP!
Komisch...Lag doch an den Treibern.
03:52 gepostet. Konntest wohl nicht schlafen... ![]()
Gruß,
UEZ
Nun ja, vielleicht hilf dir das weiter:
;Coded by UEZ 2009
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GUIConstants.au3>
#include <GDIPlus.au3>
Global Const $width = 640
Global Const $height = 480
Global Const $pi_div_180 = 4 * ATan(1) / 180
Global $graphics, $backbuffer, $bitmap, $Pen, $arrTxt1, $arrTxt2, $fontsize_txt1, $fontsize_txt2
Global $hBrush, $hFamily1, $hFamily2, $hFont1, $hFont2, $hFormat, $tLayout1, $tLayout2
Global $x1, $x2, $y1, $y2, $a, $b
Global $i = 0, $j = 360, $m = 0, $n = 0
Global $radius_x, $radius_y
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)
_GDIPlus_GraphicsSetSmoothingMode($backbuffer, 2)
$hBrush = _GDIPlus_BrushCreateSolid(0)
_GDIPlus_BrushSetSolidColor($hBrush, 0xFFF0F0F0)
$fontsize_txt1 = 48
$fontsize_txt2 = 24
$radius_x1 = ($width * 0.45) * 0.95
$radius_y1 = ($height * 0.45) * 0.95
$radius_x2 = ($width * 0.45) * 0.45
$radius_y2 = ($height * 0.45) * 0.45
$text1 = " Rotating Letters"
$text2 = " By UEZ ;-)"
$arrTxt1 = StringSplit($text1, "")
$arrTxt2 = StringSplit($text2, "")
Dim $arrX1[UBound($arrTxt1)]
Dim $arrY1[UBound($arrTxt1)]
Dim $arrX2[UBound($arrTxt2)]
Dim $arrY2[UBound($arrTxt2)]
$hFormat = _GDIPlus_StringFormatCreate()
$hFamily1 = _GDIPlus_FontFamilyCreate("Arial")
$hFamily2 = _GDIPlus_FontFamilyCreate("Comic Sans MS")
$hFont1 = _GDIPlus_FontCreate($hFamily1, $fontsize_txt1, 2)
$hFont2 = _GDIPlus_FontCreate($hFamily2, $fontsize_txt2, 2)
$tLayout1 = _GDIPlus_RectFCreate(0, 0)
$tLayout2 = _GDIPlus_RectFCreate(0, 0)
$a = 360 / (UBound($arrTxt1) - 1)
$b = 360 / (UBound($arrTxt2) - 1)
Do
_GDIPlus_GraphicsClear($backbuffer, 0x90000000)
For $x = 1 To UBound($arrTxt1) - 1
$x1 = $width * 0.45 + Cos(($i + $m) * $pi_div_180) * $radius_x1
$y1 = $height * 0.45 + Sin(($i + $m) * $pi_div_180) * $radius_y1 - $fontsize_txt1 / 4
$arrX1[$x] = $x1
$arrY1[$x] = $y1
DllStructSetData($tLayout1, "x", $arrX1[$x])
DllStructSetData($tLayout1, "y", $arrY1[$x])
_GDIPlus_GraphicsDrawStringEx($backbuffer, $arrTxt1[$x], $hFont1, $tLayout1, $hFormat, $hBrush)
$m += $a
Next
For $x = 1 To UBound($arrTxt2) - 1
$x2 = $width * 0.45 + Cos(($j + $n) * $pi_div_180) * $radius_x2
$y2 = $height * 0.45 + Sin(($j + $n) * $pi_div_180) * $radius_y2 - $fontsize_txt2 / 4
$arrX2[$x] = $x2
$arrY2[$x] = $y2
DllStructSetData($tLayout2, "x", $arrX2[$x])
DllStructSetData($tLayout2, "y", $arrY2[$x])
_GDIPlus_GraphicsDrawStringEx($backbuffer, $arrTxt2[$x], $hFont2, $tLayout2, $hFormat, $hBrush)
$n += $b
Next
_GDIPlus_GraphicsDrawImageRect($graphics, $bitmap, 0, 0, $width, $height)
$i += 1
If $i >= 360 Then
$i = 0
$m = 0
EndIf
$j -= 2
If $j <= 0 Then
$j = 360
$n = 0
EndIf
Until False * Not Sleep(30)
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
Func Close()
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_FontDispose($hFont1)
_GDIPlus_FontDispose($hFont2)
_GDIPlus_FontFamilyDispose($hFamily1)
_GDIPlus_FontFamilyDispose($hFamily2)
_GDIPlus_StringFormatDispose($hFormat)
_GDIPlus_GraphicsDispose($backbuffer)
_GDIPlus_BitmapDispose($bitmap)
_GDIPlus_GraphicsDispose($graphics)
_GDIPlus_Shutdown()
WinClose($hwnd)
Exit
EndFunc
Gruß,
UEZ ![]()
PS: habe ich auf die schnelle zusammen gecodet! ![]()
Also, mit der neueren Treiberversion 6.14.11.8618 (10.06.2009) funzt jetzt auch unter WinXP!
Scheint wohl ein Treiberproblem gewesen zu sein; wollte ich nur mal erwähnen!
Gruß,
UEZ
Ich glaube, Beep() funktioniert nur mit Systemlautsprechern! D.h. in deinem Computergehäuse sollte irgendwo ein Lautsprecher sein, das ans Mainboard angeschlossen ist.
Z.B. höre ich auch auf meinem Notebook kein Beep(), vermutlich sind die Lautsprecher nicht über das Mainboard ansprechbar.
Schau' mal hier: http://www.autoitscript.com/forum/index.php?showtopic=30069
Gruß,
UEZ