Bildschirmschoner incl. Config und Preview

  • Ich habe etwas experimentiert mit der _GDIPlus_TextureCreate Funktion aus GDI+ Kreisförmiger Ausschnitt einer Bitmap
    und daraus ist dann dieser Bildschirmschoner entstanden

    Kompilieren, Rechtsklick auf Datei -> Installieren
    Man landet direkt in den Bildschirmschoner-Eigenschaften und sollte dort das Script im Previewfenster bereits in Aktion sehen

    (Die .EXE wird nach dem Kompilieren automatisch in .SCR umbenannt; sollte dem nicht so sein, dann muß man das manuell machen)

    Spoiler anzeigen
    [autoit]

    #AutoIt3Wrapper_Run_After="CMD.exe /c del "%scriptdir%\%scriptfile%.scr""
    #AutoIt3Wrapper_Run_After="CMD.exe /c rename "%scriptdir%\%scriptfile%.exe" "%scriptfile%.scr""
    #NoTrayIcon

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

    #include <GDIPlus.au3>
    #include <GUIConstantsEx.au3>
    #include <ScreenCapture.au3>
    #include <SendMessage.au3>
    #include <StaticConstants.au3>
    #include <WinAPI.au3>
    #include <WindowsConstants.au3>

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

    While WinExists("Eukalyptus Bubble ScreenSaver")
    $hWnd = WinGetHandle("Eukalyptus Bubble ScreenSaver")
    _SendMessage($hWnd, $WM_DESTROY)
    WinWaitClose("Eukalyptus Bubble ScreenSaver", "", 2)
    WEnd

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

    Global $iMode = 0, $hParent, $aTemp, $sCmdLine = ""
    Global $iWidth = @DesktopWidth
    Global $iHeight = @DesktopHeight
    Global $iGuiX = 0, $iGuiY = 0, $iGuiW = $iWidth, $iGuiH = $iHeight

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

    Global $iBubbleCnt = RegRead("HKEY_CURRENT_USER\SOFTWARE\BubbleScreenSaver", "BubbleCount")
    If Not $iBubbleCnt Then $iBubbleCnt = 50
    If $iBubbleCnt < 1 Then $iBubbleCnt = 1
    If $iBubbleCnt > 200 Then $iBubbleCnt = 200

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

    Global $iBubbleSizeMin = RegRead("HKEY_CURRENT_USER\SOFTWARE\BubbleScreenSaver", "BubbleSizeMin")
    If Not $iBubbleSizeMin Then $iBubbleSizeMin = 50
    If $iBubbleSizeMin < 10 Then $iBubbleSizeMin = 10
    If $iBubbleSizeMin > 499 Then $iBubbleSizeMin = 499

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

    Global $iBubbleSizeMax = RegRead("HKEY_CURRENT_USER\SOFTWARE\BubbleScreenSaver", "BubbleSizeMax")
    If Not $iBubbleSizeMax Then $iBubbleSizeMax = 200
    If $iBubbleSizeMax <= $iBubbleSizeMin Then $iBubbleSizeMax = $iBubbleSizeMin + 1
    If $iBubbleSizeMax > 500 Then $iBubbleSizeMax = 500

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

    Global $iBubbleSpeedMin = RegRead("HKEY_CURRENT_USER\SOFTWARE\BubbleScreenSaver", "BubbleSpeedMin")
    If Not $iBubbleSpeedMin Then $iBubbleSpeedMin = 2
    If $iBubbleSpeedMin < 1 Then $iBubbleSpeedMin = 1
    If $iBubbleSpeedMin > 49 Then $iBubbleSpeedMin = 49

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

    Global $iBubbleSpeedMax = RegRead("HKEY_CURRENT_USER\SOFTWARE\BubbleScreenSaver", "BubbleSpeedMax")
    If Not $iBubbleSpeedMax Then $iBubbleSpeedMax = 10
    If $iBubbleSpeedMax <= $iBubbleSpeedMin Then $iBubbleSpeedMax = $iBubbleSpeedMin + 1
    If $iBubbleSpeedMax > 50 Then $iBubbleSpeedMax = 50

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

    Global $iBubbleFillMode = RegRead("HKEY_CURRENT_USER\SOFTWARE\BubbleScreenSaver", "BubbleFillMode")
    If Not $iBubbleFillMode Then $iBubbleFillMode = 4

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

    Global $aBubble[201][4]
    For $i = 0 To $iBubbleCnt
    $aBubble[$i][0] = Random(0, $iWidth, 1)
    $aBubble[$i][1] = Random(0, $iHeight, 1) + $iHeight
    $aBubble[$i][2] = Random($iBubbleSizeMin, $iBubbleSizeMax, 1)
    $aBubble[$i][3] = Random($iBubbleSpeedMin, $iBubbleSpeedMax)
    Next

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

    Switch $CmdLine[0]
    Case 0
    Exit
    Case Else
    For $i = 1 To $CmdLine[0]
    $sCmdLine &= $CmdLine[$i]
    Next
    $aTemp = StringRegExp($sCmdLine, "/(\w)", 1)
    If @error Or Not IsArray($aTemp) Then Exit
    Switch $aTemp[0]
    Case "c"
    $iMode = 2
    Case "p"
    $iMode = 3
    Case "s"
    $iMode = 1
    Case Else
    Exit
    EndSwitch
    Switch $iMode
    Case 1
    $hParent = _WinAPI_GetDesktopWindow()
    Case Else
    $aTemp = StringRegExp($sCmdLine, "\d+", 1)
    If @error Or Not IsArray($aTemp) Then Exit
    $hParent = HWnd($aTemp[0])
    EndSwitch
    EndSwitch

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

    Switch $iMode
    Case 2 ; Config
    $iGuiW = 270
    $iGuiH = 330
    $iGuiX = $iWidth / 2 - $iGuiW / 2
    $iGuiY = $iHeight / 2 - $iGuiH / 2
    Case 3 ; Preview
    Local $aPos = WinGetPos($hParent)
    If @error Or Not IsArray($aPos) Then Exit
    $iGuiX = $aPos[0]
    $iGuiY = $aPos[1]
    $iGuiW = $aPos[2]
    $iGuiH = $aPos[3]
    EndSwitch

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

    Global $hBmp = _ScreenCapture_Capture("", 0, 0, $iWidth, $iHeight, False)
    _GDIPlus_Startup()

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

    Global $hUser32dll = DllOpen("User32.dll")

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

    Switch $iMode
    Case 2 ; Config
    Global $hGui = GUICreate("Eukalyptus Bubble ScreenSaver", $iGuiW, $iGuiH, $iGuiX, $iGuiY, Default, $WS_EX_TOPMOST, $hParent)
    GUICtrlCreateLabel("Anzahl der Blasen:", 10, 10, $iGuiW - 50, 20)
    Global $hSliderCnt = GUICtrlCreateSlider(10, 30, $iGuiW - 20, 20)
    GUICtrlSetLimit(-1, 200, 1)
    GUICtrlSetData(-1, $iBubbleCnt)
    Global $hLabelCnt = GUICtrlCreateLabel($iBubbleCnt, $iGuiW - 100, 10, 90, 20, $SS_RIGHT)

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

    GUICtrlCreateLabel("Minimale Größe der Blasen:", 10, 60, $iGuiW - 50, 20)
    Global $hSliderSizeMin = GUICtrlCreateSlider(10, 80, $iGuiW - 20, 20)
    GUICtrlSetLimit(-1, 499, 10)
    GUICtrlSetData(-1, $iBubbleSizeMin)
    Global $hLabelSizeMin = GUICtrlCreateLabel($iBubbleSizeMin, $iGuiW - 50, 60, 40, 20, $SS_RIGHT)

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

    GUICtrlCreateLabel("Maximale Größe der Blasen:", 10, 110, $iGuiW - 50, 20)
    Global $hSliderSizeMax = GUICtrlCreateSlider(10, 130, $iGuiW - 20, 20)
    GUICtrlSetLimit(-1, 500, 11)
    GUICtrlSetData(-1, $iBubbleSizeMax)
    Global $hLabelSizeMax = GUICtrlCreateLabel($iBubbleSizeMax, $iGuiW - 50, 110, 40, 20, $SS_RIGHT)

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

    GUICtrlCreateLabel("Minimale Geschwindigkeit der Blasen:", 10, 160, $iGuiW - 50, 20)
    Global $hSliderSpeedMin = GUICtrlCreateSlider(10, 180, $iGuiW - 20, 20)
    GUICtrlSetLimit(-1, 49, 1)
    GUICtrlSetData(-1, $iBubbleSpeedMin)
    Global $hLabelSpeedMin = GUICtrlCreateLabel($iBubbleSpeedMin, $iGuiW - 50, 160, 40, 20, $SS_RIGHT)

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

    GUICtrlCreateLabel("Maximale Geschwindigkeit der Blasen:", 10, 210, $iGuiW - 50, 20)
    Global $hSliderSpeedMax = GUICtrlCreateSlider(10, 230, $iGuiW - 20, 20)
    GUICtrlSetLimit(-1, 50, 2)
    GUICtrlSetData(-1, $iBubbleSpeedMax)
    Global $hLabelSpeedMax = GUICtrlCreateLabel($iBubbleSpeedMax, $iGuiW - 50, 210, 40, 20, $SS_RIGHT)

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

    Global $hCheckbox=GUICtrlCreateCheckbox("Keine Füllung bei Überschneidung",10,260,$iGuiW-20,20)
    If $iBubbleFillMode = 1 Then GUICtrlSetState($hCheckbox, $GUI_CHECKED)

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

    Global $hButtonSave = GUICtrlCreateButton("OK", 10, 300, $iGuiW / 2 - 20, 20)
    Global $hButtonExit = GUICtrlCreateButton("Abbrechen", $iGuiW / 2 + 10, 300, $iGuiW / 2 - 20, 20)
    Case Else
    Global $hGui = GUICreate("Eukalyptus Bubble ScreenSaver", $iGuiW, $iGuiH, $iGuiX, $iGuiY, $WS_POPUP, $WS_EX_TOPMOST, $hParent)
    EndSwitch

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

    Switch $iMode
    Case 3
    Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hParent)
    GUISetState(@SW_HIDE)
    Case Else
    Global $hGraphics = _GDIPlus_GraphicsCreateFromHWND($hGui)
    GUISetState(@SW_SHOW)
    EndSwitch

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

    Global $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP($hBmp)
    Global $hBrush = _GDIPlus_TextureCreate($hBitmap)
    Global $hBrushTrans = _GDIPlus_BrushCreateSolid(0xF6000010)
    Global $hBmpBuffer = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphics)
    Global $hGfxBuffer = _GDIPlus_ImageGetGraphicsContext($hBmpBuffer)
    Global $hPen = _GDIPlus_PenCreate(0xFF101000)

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

    Global $iTimer = TimerInit()

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

    If $iMode = 1 Then
    GUIRegisterMsg($WM_MOUSEMOVE, "WM_MOUSEMOVE")
    _WinAPI_ShowCursor(False)
    EndIf

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

    If $iMode <> 2 Then
    GUIRegisterMsg($WM_PAINT, "WM_PAINT")
    GUIRegisterMsg($WM_ERASEBKGND, "WM_ERASEBKGND")
    EndIf

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

    GUIRegisterMsg($WM_DESTROY, "WM_DESTROY")

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

    While 1
    Switch $iMode
    Case 2 ; Config
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
    _Exit()
    Case $hSliderCnt
    $iBubbleCnt = GUICtrlRead($hSliderCnt)
    GUICtrlSetData($hLabelCnt, $iBubbleCnt)
    Case $hSliderSizeMin
    $iBubbleSizeMin = GUICtrlRead($hSliderSizeMin)
    If $iBubbleSizeMin >= $iBubbleSizeMax Then
    $iBubbleSizeMin = $iBubbleSizeMax - 1
    GUICtrlSetData($hSliderSizeMin, $iBubbleSizeMin)
    EndIf
    GUICtrlSetData($hLabelSizeMin, $iBubbleSizeMin)
    Case $hSliderSizeMax
    $iBubbleSizeMax = GUICtrlRead($hSliderSizeMax)
    If $iBubbleSizeMax <= $iBubbleSizeMin Then
    $iBubbleSizeMax = $iBubbleSizeMin + 1
    GUICtrlSetData($hSliderSizeMax, $iBubbleSizeMax)
    EndIf
    GUICtrlSetData($hLabelSizeMax, $iBubbleSizeMax)
    Case $hSliderSpeedMin
    $iBubbleSpeedMin = GUICtrlRead($hSliderSpeedMin)
    If $iBubbleSpeedMin >= $iBubbleSpeedMax Then
    $iBubbleSpeedMin = $iBubbleSpeedMax - 1
    GUICtrlSetData($hSliderSpeedMin, $iBubbleSpeedMin)
    EndIf
    GUICtrlSetData($hLabelSpeedMin, $iBubbleSpeedMin)
    Case $hSliderSpeedMax
    $iBubbleSpeedMax = GUICtrlRead($hSliderSpeedMax)
    If $iBubbleSpeedMax <= $iBubbleSpeedMin Then
    $iBubbleSpeedMax = $iBubbleSpeedMin + 1
    GUICtrlSetData($hSliderSpeedMax, $iBubbleSpeedMax)
    EndIf
    GUICtrlSetData($hLabelSpeedMax, $iBubbleSpeedMax)
    Case $hCheckbox
    $iBubbleFillMode=GUICtrlRead($hCheckbox)
    If $iBubbleFillMode <> 1 And $iBubbleFillMode <> 4 Then $iBubbleFillMode = 4
    Case $hButtonExit
    _Exit()
    Case $hButtonSave
    RegWrite("HKEY_CURRENT_USER\SOFTWARE\BubbleScreenSaver", "BubbleCount", "REG_DWORD", $iBubbleCnt)
    RegWrite("HKEY_CURRENT_USER\SOFTWARE\BubbleScreenSaver", "BubbleSizeMin", "REG_DWORD", $iBubbleSizeMin)
    RegWrite("HKEY_CURRENT_USER\SOFTWARE\BubbleScreenSaver", "BubbleSizeMax", "REG_DWORD", $iBubbleSizeMax)
    RegWrite("HKEY_CURRENT_USER\SOFTWARE\BubbleScreenSaver", "BubbleSpeedMin", "REG_DWORD", $iBubbleSpeedMin)
    RegWrite("HKEY_CURRENT_USER\SOFTWARE\BubbleScreenSaver", "BubbleSpeedMax", "REG_DWORD", $iBubbleSpeedMax)
    RegWrite("HKEY_CURRENT_USER\SOFTWARE\BubbleScreenSaver", "BubbleFillMode", "REG_DWORD", $iBubbleFillMode)
    _Exit()
    EndSwitch
    Case Else
    If TimerDiff($iTimer) > 20 Then
    If $iMode = 3 And Not WinExists($hParent) Then _Exit()
    $iTimer = TimerInit()
    _Bubbles()
    EndIf
    EndSwitch
    WEnd

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

    Func WM_DESTROY($hWnd, $uMsgm, $wParam, $lParam)
    _Exit()
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_DESTROY

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

    Func WM_PAINT($hWnd, $uMsgm, $wParam, $lParam)
    _Draw()
    Return $GUI_RUNDEFMSG
    EndFunc ;==>WM_PAINT

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

    Func WM_ERASEBKGND($hWnd, $uMsgm, $wParam, $lParam)
    _Draw()
    Return True
    EndFunc ;==>WM_ERASEBKGND

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

    Func _Draw()
    Switch $iMode
    Case 1 ; FullScreen
    _GDIPlus_GraphicsDrawImage($hGraphics, $hBmpBuffer, 0, 0)
    Case 3 ; Preview
    _GDIPlus_GraphicsDrawImageRect($hGraphics, $hBmpBuffer, 0, 0, $iGuiW, $iGuiH)
    EndSwitch
    EndFunc ;==>_Draw

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

    Func _Bubbles()
    If $iBubbleFillMode = 1 Then Local $hPath = _GDIPlus_CreatePath()
    Local $sKeyBoard = _GetKeyboardState()
    Local Static $sKeyBoard_Old = $sKeyBoard
    If $iMode = 1 And $sKeyBoard_Old <> $sKeyBoard Then _Exit()
    $sKeyBoard_Old = $sKeyBoard
    _GDIPlus_GraphicsDrawImage($hGfxBuffer, $hBitmap, 0, 0)
    _GDIPlus_GraphicsFillRect($hGfxBuffer, 0, 0, $iWidth, $iHeight, $hBrushTrans)
    For $i = 1 To $iBubbleCnt
    If $aBubble[$i][1] + $aBubble[$i][2] / 2 < 0 Then
    $aBubble[$i][0] = Random(0, $iWidth, 1)
    $aBubble[$i][2] = Random($iBubbleSizeMin, $iBubbleSizeMax, 1)
    $aBubble[$i][1] = $iHeight + $aBubble[$i][2] / 2
    $aBubble[$i][3] = Random($iBubbleSpeedMin, $iBubbleSpeedMax)
    EndIf
    $aBubble[$i][1] -= $aBubble[$i][3]
    Switch $iBubbleFillMode
    Case 1
    _GDIPlus_AddPathEllipse($hPath,$aBubble[$i][0] - $aBubble[$i][2] / 2, $aBubble[$i][1] - $aBubble[$i][2] / 2, $aBubble[$i][2], $aBubble[$i][2])
    Case Else
    _GDIPlus_GraphicsFillEllipse($hGfxBuffer, $aBubble[$i][0] - $aBubble[$i][2] / 2, $aBubble[$i][1] - $aBubble[$i][2] / 2, $aBubble[$i][2], $aBubble[$i][2], $hBrush)
    _GDIPlus_GraphicsDrawEllipse($hGfxBuffer, $aBubble[$i][0] - $aBubble[$i][2] / 2, $aBubble[$i][1] - $aBubble[$i][2] / 2, $aBubble[$i][2], $aBubble[$i][2], $hPen)
    EndSwitch
    Next
    If $iBubbleFillMode = 1 Then
    _GDIPlus_ClosePathFigure($hPath)
    _GDIPlus_FillPath($hGfxBuffer, $hBrush, $hPath)
    _GDIPlus_PathDispose($hPath)
    EndIf
    _Draw()
    EndFunc ;==>_Bubbles

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

    Func _GDIPlus_CreatePath($brushMode = 0)
    Local $hPath
    $hPath = DllCall($ghGDIPDll, "int", "GdipCreatePath", "int", $brushMode, "handle*", 0)
    If @error Then Return SetError(1, @error, 0)
    Return SetError($hPath[0], 0, $hPath[2])
    EndFunc ;==>_GDIPlus_CreatePath

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

    Func _GDIPlus_AddPathEllipse($hPath, $iX, $iY, $iWidth, $iHeight)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipAddPathEllipse", "handle", $hPath, "float", $iX, "float", $iY, "float", $iWidth, "float", $iHeight)
    If @error Then Return SetError(1, @error, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc ;==>_GDIPlus_AddPathEllipse

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

    Func _GDIPlus_FillPath($hGraphic, $hBrushGrad, $hPath)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipFillPath", "handle", $hGraphic, "handle", $hBrushGrad, "handle", $hPath)
    If @error Then Return SetError(1, @error, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc ;==>_GDIPlus_FillPath

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

    Func _GDIPlus_ClosePathFigure($hPath)
    Local $aResult = DllCall($ghGDIPDll, "int", "GdipClosePathFigure", "handle", $hPath)
    If @error Then Return SetError(1, @error, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc ;==>_GDIPlus_ClosePathFigure

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

    Func _GDIPlus_PathDispose($hPath)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipDeletePath", "handle", $hPath)
    If @error Then Return SetError(1, @error, 0)
    Return SetError($aResult[0], 0, $aResult[0] = 0)
    EndFunc ;==>_GDIPlus_PathDispose

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

    Func WM_MOUSEMOVE($hWnd, $uMsgm, $wParam, $lParam)
    If $iMode <> 1 Then Return 0
    Local $iMouseX = MouseGetPos(0)
    Local $iMouseY = MouseGetPos(1)
    Local Static $iMouseX_Old = $iMouseX
    Local Static $iMouseY_Old = $iMouseY
    If $hWnd = $hGui Then
    If $iMouseX < $iMouseX_Old - 3 Or $iMouseX > $iMouseX_Old + 3 Or $iMouseY < $iMouseY_Old - 3 Or $iMouseY > $iMouseY_Old + 3 Then _Exit()
    $iMouseX_Old = $iMouseX
    $iMouseY_Old = $iMouseY
    EndIf
    Return 0
    EndFunc ;==>WM_MOUSEMOVE

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

    Func _GetKeyboardState()
    Local $sReturn = ""
    Local $lpKeyState = DllStructCreate("byte[256]")
    Local $aRet = DllCall($hUser32dll, "int", "GetKeyboardState", "ptr", DllStructGetPtr($lpKeyState))
    For $i = 1 To 256
    $sReturn &= DllStructGetData($lpKeyState, 1, $i)
    Next
    Return $sReturn
    EndFunc ;==>_GetKeyboardState

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

    ; #FUNCTION# ====================================================================================================================
    ; Name...........: _GDIPlus_TextureCreate
    ; Description ...: Creates a TextureBrush object based on an image and a wrap mode
    ; Syntax.........: _GDIPlus_TextureCreate($hImage[, $iWrapMode = 0])
    ; Parameters ....: $hImage - Pointer to an Image object
    ; $iWrapMode - Wrap mode that specifies how repeated copies of an image are used to tile an area when it is
    ; +painted with the texture brush:
    ; |0 - Tiling without flipping
    ; |1 - Tiles are flipped horizontally as you move from one tile to the next in a row
    ; |2 - Tiles are flipped vertically as you move from one tile to the next in a column
    ; |3 - Tiles are flipped horizontally as you move along a row and flipped vertically as you move along a column
    ; |4 - No tiling takes place
    ; Return values .: Success - Pointer to a new TextureBrush object
    ; Failure - 0 and either:
    ; |@error and @extended are set if DllCall failed
    ; |$GDIP_STATUS contains a non zero value specifying the error code
    ; Remarks .......: The size of the brush defaults to the size of the image, so the entire image is used by the brush
    ; After you are done with the object, call _GDIPlus_BrushDispose to release the object resources
    ; Related .......: _GDIPlus_BrushDispose
    ; Link ..........; @@MsdnLink@@ GdipCreateTexture
    ; Example .......; No
    ; ===============================================================================================================================
    Func _GDIPlus_TextureCreate($hImage, $iWrapMode = 0)
    Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateTexture", "hwnd", $hImage, "int", $iWrapMode, "int*", 0)

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

    If @error Then Return SetError(@error, @extended, 0)
    $GDIP_STATUS = $aResult[0]
    Return $aResult[3]
    EndFunc ;==>_GDIPlus_TextureCreate

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

    Func _Exit()
    _GDIPlus_PenDispose($hPen)
    _GDIPlus_BrushDispose($hBrush)
    _GDIPlus_BrushDispose($hBrushTrans)
    _GDIPlus_GraphicsDispose($hGfxBuffer)
    _GDIPlus_BitmapDispose($hBmpBuffer)
    _WinAPI_DeleteObject($hBmp)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_GraphicsDispose($hGraphics)
    _GDIPlus_Shutdown()
    DllClose($hUser32dll)
    GUIDelete($hGui)
    _WinAPI_ShowCursor(True)
    Exit
    EndFunc ;==>_Exit

    [/autoit]

    Viel Spaß

  • Du hast ein Bug in der Preview Sektion: wenn du deinen BS auswählst und anschließend einen Anderen, wird der Child Prozess deines BS unter Rundll32.exe nicht beendet :!:

    Ansonsten interessanter Code! :D

    Gruß,
    UEZ

    Auch am Arsch geht ein Weg vorbei...

    ¯\_(ツ)_/¯

    Einmal editiert, zuletzt von UEZ (25. April 2010 um 21:40)

  • Ja, das weiß ich.

    Der Prozess wird erst beendet, wenn das BS-Einstellungsfenster geschlossen wird, oder eine andere Instanz vom BS (Preview, Config, Fullscreen...) gestartet wird.
    Ich hab leider noch nicht herausgefunden, wie ich besser erkennen kann, daß der BS beendet werden soll.

    Normalerweise sollte doch Windows irgendeine Message schicken!?

    E