Function gesucht!

  • Hi,
    ich hab heute eine total blöde Frage, denn ich suche das Beispielscript von einer Function, dessen name ich vergessen hab.
    Ich weiß ihn noch teilweise und habe die Hilfe schon durchsuchte, war jedoch erfolglos.
    Meine Hinweise sind:
    "overdrawn" "button" oder so
    in dem Script steht eine Funktion drin, welches das designische klicken eines Buttons nachstellt ( dieser leichte 3D Effekt wenn mann einen Button drückt )
    Hoffe auf Lösung,
    Xyron

    Meine Werke


    EasyScreen (teilweise Crocoframe): <EasyScreen>
    Spotify2Title: <Spotify2Title> (zur Info, dies ist KEIN Spotify-Downloader! Wer das dachte... :rofl: sowas gibts hier nicht :thumbdown: )

    Einmal editiert, zuletzt von Xyron (30. Mai 2010 um 18:09)

  • Nein, ich glaube ich weiß welchen Thread Du meinst, erinnere mich aber auch nicht mehr an den Titel.

    Brauchst Dich aber nicht weiter anstrengen ... ;)

    Spoiler anzeigen
    [autoit]

    #include-once

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

    #include <Constants.au3>
    #include <GuiConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include <ButtonConstants.au3>

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

    OnAutoItExitRegister ("AppExit")

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

    ; --- $DRAWITEMSTRUCT
    Global Const $DRAWITEMSTRUCT = _
    'uint CtlType;'& _
    'uint CtlID;'& _
    'uint itemID;'& _
    'uint itemAction;'& _
    'uint itemState;'& _
    'hwnd hwndItem;'& _
    'ptr hDC;'& _
    'long rcItem[4];'& _
    'ulong_ptr itemData;'

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

    Global Enum $PBS_NORMAL = 1, _
    $PBS_HOT, _
    $PBS_PRESSED, _
    $PBS_DISABLED, _
    $PBS_DEFAULTED, _
    $PBS_DEFAULTED_ANIMATING

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

    Global Const $BP_PUSHBUTTON = 1

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

    Global $g_hTheme
    Global $g_hThemeLib

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

    Global $g_hButtonProc
    Global $g_bMouseHover = False

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

    Global $ID_BUTTON_0
    Global $ID_BUTTON_1

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

    ;««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

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

    $g_hThemeLib = DllOpen ("uxtheme.dll")
    If ($g_hThemeLib == -1) Then
    ConsoleWrite ("! g_hThemeLib = "&$g_hThemeLib & @crlf)
    Else
    MainDlg ( )
    EndIf

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

    Exit (0)

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

    Func MainDlg ( )

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

    Local $hWnd
    Local $hwndButton_1

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

    $hWnd = GUICreate ("Themed Ownerdraw Demo", 400, 300)

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

    $ID_BUTTON_1 = GUICtrlCreateButton ("Ownerdraw", 25, 85, 350, 90)
    $ID_BUTTON_0 = GUICtrlCreateButton ("Standard", 25, 185, 350, 90)

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

    GUICtrlSetStyle ($ID_BUTTON_1, BitOR($WS_TABSTOP, $BS_NOTIFY, $BS_OWNERDRAW))
    GUICtrlSetTip ($ID_BUTTON_1, "Selbstgezeichnete Schaltfläche")

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

    $hwndButton_1 = GUICtrlGetHandle ($ID_BUTTON_1)
    $g_hTheme = OpenThemeData ($hwndButton_1, "Button")

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

    ;~ $g_hButtonProc = DllCallbackRegister ("ButtonWndProc", "long", "hwnd;uint;long;long")

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

    GUIRegisterMsg ($WM_DRAWITEM, "WM_DRAWITEM")
    GUIRegisterMsg ($WM_MOUSEMOVE, "WM_MOUSEMOVE")

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

    GUISetState (5, $hWnd)

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

    While True

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

    Switch GUIGetMsg ( )
    Case $GUI_EVENT_CLOSE
    ExitLoop
    EndSwitch
    WEnd

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

    EndFunc

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

    Func WM_DRAWITEM ($hwnd, $message, $wParam, $lParam)

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

    Local Const $ODA_DRAWENTIRE = 0x0001
    Local Const $ODA_SELECT = 0x0002
    Local Const $ODA_FOCUS = 0x0004
    Local Const $ODS_SELECTED = 0x0001
    Local Const $ODS_GRAYED = 0x0002
    Local Const $ODS_DISABLED = 0x0004
    Local Const $ODS_CHECKED = 0x0008
    Local Const $ODS_FOCUS = 0x0010
    Local Const $ODS_HOTLIGHT = 0x0040
    Local Const $ODS_INACTIVE = 0x0080
    Local Const $ODS_NOACCEL = 0x0100
    Local Const $ODS_NOFOCUSRECT = 0x0200

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

    Local $dis = DllStructCreate ($DRAWITEMSTRUCT, $lParam)
    Local $hDC = DllStructGetData ($dis, "hDC")
    Local $hwndItem = DllStructGetData ($dis, "hwndItem")
    Local $nItemAction = DllStructGetData ($dis, "itemAction")
    Local $nItemState = DllStructGetData ($dis, "itemState")

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

    Local $lprcItem = DllStructGetPtr ($dis, 8)

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

    Local $bChecked = BitAND($nItemState, $ODS_CHECKED)
    Local $bFocused = BitAND($nItemState, $ODS_FOCUS)
    Local $bGrayed = BitAND($nItemState, BitOR($ODS_GRAYED, $ODS_DISABLED))
    Local $bSelected = BitAND($nItemState, $ODS_SELECTED)

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

    Local $sFormat = "> WM_DRAWITEM (%#x, %d, %#x, %#x)"

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

    ConsoleWrite (StringFormat ($sFormat, $hwnd, $message, $wParam, $lParam) & @crlf)
    ConsoleWrite ("> CtlType = "&DllStructGetData ($dis, 1) & @crlf)
    ConsoleWrite ("> CtlID = "&DllStructGetData ($dis, 2) & @crlf)
    ConsoleWrite ("> itemID = "&DllStructGetData ($dis, 3) & @crlf)
    ConsoleWrite ("> itemAction = "&DllStructGetData ($dis, 4) & @crlf)
    ConsoleWrite ("> itemState = "&Ptr (DllStructGetData ($dis, 5)) & @crlf)
    ConsoleWrite ("> hwndItem = "&DllStructGetData ($dis, 6) & @crlf)
    ConsoleWrite ("> hDC = "&DllStructGetData ($dis, 7) & @crlf)
    ConsoleWrite ("> rcItem.left = "&DllStructGetData ($dis, 8, 1) & @crlf)
    ConsoleWrite ("> rcItem.top = "&DllStructGetData ($dis, 8, 2) & @crlf)
    ConsoleWrite ("> rcItem.right = "&DllStructGetData ($dis, 8, 3) & @crlf)
    ConsoleWrite ("> rcItem.bottom = "&DllStructGetData ($dis, 8, 4) & @crlf)
    ConsoleWrite ("> itemData = "&DllStructGetData ($dis, 9) & @crlf)

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

    ConsoleWrite ("--------------------" & @crlf)

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

    If ($nItemAction == $ODA_DRAWENTIRE) Then

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

    If ($bFocused) Then
    If ($bSelected) Then
    DrawControlTheme ($hDC, $lprcItem, $hwndItem, $g_hTheme, $PBS_PRESSED)
    Else
    DrawControlTheme ($hDC, $lprcItem, $hwndItem, $g_hTheme, $PBS_DEFAULTED)
    EndIf
    InflateRect ($lprcItem, -3, -3)
    DrawFocusRect ($hDC, $lprcItem)
    Else
    DrawControlTheme ($hDC, $lprcItem, $hwndItem, $g_hTheme, $PBS_NORMAL)
    EndIf

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

    ElseIf ($nItemAction == $ODA_FOCUS) Then

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

    If ($bFocused) Then
    DrawControlTheme ($hDC, $lprcItem, $hwndItem, $g_hTheme, $PBS_DEFAULTED)
    EndIf
    If ($bSelected) Then
    DrawControlTheme ($hDC, $lprcItem, $hwndItem, $g_hTheme, $PBS_PRESSED)
    EndIf
    InflateRect ($lprcItem, -3, -3)
    DrawFocusRect ($hDC, $lprcItem)
    EndIf

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

    Return 1

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

    EndFunc

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

    Func WM_MOUSEMOVE ($hwnd, $message, $wParam, $lParam)

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

    EndFunc

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

    Func AppExit ( )

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

    if ($g_hThemeLib) then
    if ($g_hTheme) then
    CloseThemeData ($g_hTheme)
    endif
    DllClose ($g_hThemeLib)
    endif

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

    if ($g_hButtonProc) then
    DllCallbackFree ($g_hButtonProc)
    endif

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

    EndFunc
    ;««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

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

    Func DrawControlTheme ($hDC, $lprect, $hwndButton, $hTheme, $iState)

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

    Local $rc = DllStructCreate ("long;long;long;long", $lprect)
    Local $rcContent = DllStructCreate ("long;long;long;long")
    Local $szButtonText
    Local $hr
    Local $cch

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

    $szButtonText = WinGetTitle ($hwndButton)
    $cch = StringLen ($szButtonText)

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

    if ($hTheme) then

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

    $hr = DrawThemeBackground ($hTheme, $hDC, $BP_PUSHBUTTON, _
    $iState, DllStructGetPtr ($rc), 0)

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

    $hr = GetThemeBackgroundContentRect ($hTheme, $hDC, _
    $BP_PUSHBUTTON, $iState, DllStructGetPtr ($rc), DllStructGetPtr ($rcContent))

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

    $hr = DrawThemeText ($hTheme, $hDC, $BP_PUSHBUTTON, $iState, _
    $szButtonText, $cch, _
    BitOR ($DT_CENTER, $DT_VCENTER, $DT_SINGLELINE), _
    0, DllStructGetPtr ($rcContent))

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

    endif

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

    EndFunc

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

    ;««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

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

    Func InflateRect ($lprc, $dx, $dy)

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

    Local $aRes = DllCall ('user32.dll', 'int', 'InflateRect', _
    'ptr', $lprc, _ ; rectangle
    'int', $dx, _ ; amount to adjust width
    'int', $dy) ; amount to adjust height
    If @error Then _
    Return @error

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

    Return $aRes[0]

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

    EndFunc

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

    Func InvalidateRect ($hWnd, $lpRect, $bErase)

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

    Local $aRes = DllCall ('user32.dll', 'int', 'InvalidateRect', _
    'hwnd', $hWnd, _ ; handle to window
    'ptr', $lpRect, _ ; rectangle coordinates
    'int', $bErase) ; erase state
    If @error Then _
    Return @error

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

    Return $aRes[0]

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

    EndFunc

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

    Func DrawFocusRect ($hDC, $lprc)

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

    Local $aRes = DllCall ('user32.dll', 'int', 'DrawFocusRect', _
    'ptr', $hDC, _ ; handle to device context
    'ptr', $lprc) ; logical coordinates
    If @error Then _
    Return @error

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

    Return $aRes[0]

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

    EndFunc

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

    ;««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

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

    Func CloseThemeData ($hTheme)

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

    Local $aRes = DllCall ($g_hThemeLib, 'long', 'CloseThemeData', _
    'ptr', $hTheme)
    If @error Then _
    Return @error

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

    Return $aRes[0]

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

    EndFunc

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

    Func OpenThemeData ($hwnd, $pszClassList)

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

    Local $aRes = DllCall ($g_hThemeLib, 'ptr', 'OpenThemeData', _
    'hwnd', $hwnd, _
    'wstr', $pszClassList)
    If @error Then _
    Return @error

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

    Return $aRes[0]

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

    EndFunc

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

    Func DrawThemeBackground ($hTheme, $hdc, $iPartId, $iStateId, $pRect, $pClipRect)

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

    Local $aRes = DllCall ($g_hThemeLib, 'long', 'DrawThemeBackground', _
    'ptr', $hTheme, _
    'ptr', $hdc, _
    'int', $iPartId, _
    'int', $iStateId, _
    'ptr', $pRect, _
    'ptr', $pClipRect)
    If @error Then _
    Return @error

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

    Return $aRes[0]

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

    EndFunc

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

    Func DrawThemeEdge ($hTheme, $hdc, $iPartId, $iStateId, $pDestRect, $uEdge, $uFlags, $pContentRect)

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

    Local $aRes = DllCall ($g_hThemeLib, 'long', 'DrawThemeEdge', _
    'ptr', $hTheme, _
    'ptr', $hdc, _
    'int', $iPartId, _
    'int', $iStateId, _
    'ptr', $pDestRect, _
    'uint', $uEdge, _
    'uint', $uFlags, _
    'ptr', $pContentRect)
    If @error Then _
    Return @error

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

    Return $aRes[0]

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

    EndFunc

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

    Func DrawThemeText ($hTheme, $hdc, $iPartId, $iStateId, $pszText, $iCharCount, $dwTextFlags, $dwTextFlags2, $pRect)

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

    Local $aRes = DllCall ($g_hThemeLib, 'long', 'DrawThemeText', _
    'ptr', $hTheme, _
    'ptr', $hdc, _
    'int', $iPartId, _
    'int', $iStateId, _
    'wstr', $pszText, _
    'int', $iCharCount, _
    'dword', $dwTextFlags, _
    'dword', $dwTextFlags2, _
    'ptr', $pRect)
    If @error Then _
    Return @error

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

    Return $aRes[0]

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

    EndFunc

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

    Func GetThemeBackgroundContentRect ($hTheme, $hdc, $iPartId, $iStateId, $pBoundingRect, $pContentRect)

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

    Local $aRes = DllCall ($g_hThemeLib, 'long', 'GetThemeBackgroundContentRect', _
    'ptr', $hTheme, _
    'ptr', $hdc, _
    'int', $iPartId, _
    'int', $iStateId, _
    'ptr', $pBoundingRect, _
    'ptr', $pContentRect)
    If @error Then _
    Return @error

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

    Return $aRes[0]

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

    EndFunc

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

    ;««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««««

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


    Gruß
    Greenhorn

  • Ja...
    Juhuuuu...
    Danke...
    Das war das Script, da wär ich nie drauf gekommen.
    Und geil dass es nur 2-5min gedauert hat bis ne Antwort kam

    Meine Werke


    EasyScreen (teilweise Crocoframe): <EasyScreen>
    Spotify2Title: <Spotify2Title> (zur Info, dies ist KEIN Spotify-Downloader! Wer das dachte... :rofl: sowas gibts hier nicht :thumbdown: )