Schönen Abend alle.
Und hier gleich zu meinem Problem:
Ich habe ein Script geschrieben, was einen String in GDI+ darstellt. Mit dem Hotkey 1 soll man das Bild bewegen können. Das klappt ja auch soweit ganz gut. Nur flackert es dann halt total. Ich hab es dann mit VM_COMPOSITED versucht, was aber nur zufolge hatte, dass garnichtsmehr angezeigt wird.
Source ohne WS_EX_COMPOSITED
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $Y = 0, _
$dll = DllOpen("user32.dll")
Global Const $WS_EX_COMPOSITED = 0x2000000
[/autoit] [autoit][/autoit] [autoit]HotKeySet("1", "_test")
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hWnd = GUICreate("GDI+ Example", 300, 200, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU));, $WS_EX_COMPOSITED)
GUISetState()
GUIRegisterMsg(0xF, "MY_PAINT")
[/autoit] [autoit][/autoit] [autoit]$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$hBrush = _GDIPlus_BrushCreateSolid(0xFF009900)
$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, 36)
$hLayout = _GDIPlus_RectFCreate(0, 0, 300, 200)
$hStringFormat = _GDIPlus_StringFormatCreate()
_GDIPlus_StringFormatSetAlign($hStringFormat, 1)
DllCall($dll, "lparam", "SendMessage", "hwnd", $hWnd, "int", 0xF, "wparam", 0, "lparam", 0)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_FontDispose($hFont)
_GDIPlus_StringFormatDispose($hStringFormat)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
Func MY_PAINT($hWnd, $msg, $wParam, $lParam)
DllCall($ghGDIPDll, "int", "GdipGraphicsClear", "hwnd", $hGraphics, "int", 0xFF000000)
DllCall($ghGDIPDll, "int", "GdipDrawString", "hwnd", $hGraphics, "wstr", "AutoIT Rocks", "int", -1, "hwnd", $hFont, "ptr", DllStructGetPtr($hLayout), "hwnd", $hStringFormat, "hwnd", $hBrush)
Return $GUI_RUNDEFMSG
EndFunc ;==>MY_PAINT
Func _test()
$Y = $Y + 1
$hLayout = _GDIPlus_RectFCreate(0, $Y, 300, 200)
DllCall($dll, "lparam", "SendMessage", "hwnd", $hWnd, "int", 0x0000000F, "wparam", 0, "lparam", 0)
EndFunc ;==>_test
Source mit VS_EX_COMPOSITED
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
Global $Y = 0, _
$dll = DllOpen("user32.dll")
Global Const $WS_EX_COMPOSITED = 0x2000000
[/autoit] [autoit][/autoit] [autoit]HotKeySet("1", "_test")
[/autoit] [autoit][/autoit] [autoit]_GDIPlus_Startup()
[/autoit] [autoit][/autoit] [autoit]$hWnd = GUICreate("GDI+ Example", 300, 200, -1, -1, BitOR($WS_CAPTION, $WS_SYSMENU), $WS_EX_COMPOSITED)
GUISetState()
GUIRegisterMsg(0xF, "MY_PAINT")
[/autoit] [autoit][/autoit] [autoit]$hGraphics = _GDIPlus_GraphicsCreateFromHWND($hWnd)
$hBrush = _GDIPlus_BrushCreateSolid(0xFF009900)
$hFamily = _GDIPlus_FontFamilyCreate("Arial")
$hFont = _GDIPlus_FontCreate($hFamily, 36)
$hLayout = _GDIPlus_RectFCreate(0, 0, 300, 200)
$hStringFormat = _GDIPlus_StringFormatCreate()
_GDIPlus_StringFormatSetAlign($hStringFormat, 1)
DllCall($dll, "lparam", "SendMessage", "hwnd", $hWnd, "int", 0xF, "wparam", 0, "lparam", 0)
Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE
_GDIPlus_BrushDispose($hBrush)
_GDIPlus_FontFamilyDispose($hFamily)
_GDIPlus_FontDispose($hFont)
_GDIPlus_StringFormatDispose($hStringFormat)
_GDIPlus_GraphicsDispose($hGraphics)
_GDIPlus_Shutdown()
Func MY_PAINT($hWnd, $msg, $wParam, $lParam)
DllCall($ghGDIPDll, "int", "GdipGraphicsClear", "hwnd", $hGraphics, "int", 0xFF000000)
DllCall($ghGDIPDll, "int", "GdipDrawString", "hwnd", $hGraphics, "wstr", "AutoIT Rocks", "int", -1, "hwnd", $hFont, "ptr", DllStructGetPtr($hLayout), "hwnd", $hStringFormat, "hwnd", $hBrush)
Return $GUI_RUNDEFMSG
EndFunc ;==>MY_PAINT
Func _test()
$Y = $Y + 1
$hLayout = _GDIPlus_RectFCreate(0, $Y, 300, 200)
DllCall($dll, "lparam", "SendMessage", "hwnd", $hWnd, "int", 0x0000000F, "wparam", 0, "lparam", 0)
EndFunc ;==>_test
Danke schonmal für die Antworten!
MfG,
H2112
Edit:
Hab Win XP ServicPack 3
Edit2:
Problem hat sich gelöst, antwort im Vorletzten Post.