Menüleiste einfärben

  • Danke, aber damit kann ich doch nur die Farben für die Untermenüs setzen, aber nicht für das Kopfmenü, oder übersehe ich etwas?

    Einmal editiert, zuletzt von johny (10. Oktober 2006 um 19:44)

  • Paul hatte für sein X-Toolbar Script die Funktion SetMenuColor erstellt - auf Basis von Holger´s ModernMenu.au3.

    Sieht dann so aus:

    [autoit]

    #include-once

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

    Global Const $MIM_APPLYTOSUBMENUS = 0x80000000
    Global Const $MIM_BACKGROUND = 0x00000002

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

    ; Apply the color to the menu
    Func SetMenuColor($nMenuID, $nColor, $hWnd = 0, $bApplyToSub = TRUE)
    ; Minimum OS are Windows98 and 2000
    If @OSVersion = "WIN_95" Or @OSVersion = "WIN_NT4" Then Return

    If $nMenuID = 0 Then
    $hMenu = DllCall("user32.dll", "int", "GetMenu", "hwnd", $hWnd)
    $hMenu = $hMenu[0]
    Else
    $hMenu = GUICtrlGetHandle($nMenuID)
    EndIf

    $hBrush = DllCall("gdi32.dll", "hwnd", "CreateSolidBrush", "int", $nColor)
    $hBrush = $hBrush[0]

    Local $stMenuInfo = DllStructCreate("dword;dword;dword;uint;dword;dword;ptr")
    DllStructSetData($stMenuInfo, 1, DllStructGetSize($stMenuInfo))

    Local $nFlags = $MIM_BACKGROUND
    If $bApplyToSub Then $nFlags = BitOr($nFlags, $MIM_APPLYTOSUBMENUS)
    DllStructSetData($stMenuInfo, 2, $nFlags)
    DllStructSetData($stMenuInfo, 5, $hBrush)

    DllCall("user32.dll", "int", "SetMenuInfo", "hwnd", $hMenu, "ptr", DllStructGetPtr($stMenuInfo))
    EndFunc

    [/autoit]

    Das dürfte dein Problem lösen.