MsgBox mit eigenem Bild

  • Hey,
    ich möchte wie im Titel beschrieben ein Bild rechts oder links IN der MsgBox drinne haben, also nicht dieses kleine Shortcut oben sondern beim Text. Wie kann ich das machen?
    Mfg

  • Entweder erstellst du dir ein eigenes Fenster per GuiCreate oder du erstellst ein Parent-Fenster zur Msg-Box, mit $GUI_POPUP als Style und nur dem Bild als Control und schiebst es an die richtige Stelle in der Msg-Box.

    [autoit]


    Func Ulam($n)
    Return 1
    EndFunc

    [/autoit]


    Rekursion FTW :D

  • Oder Du fügst Dein Symbol den Ressourcen hinzu und ...

    Spoiler anzeigen
    [autoit]

    #include <Constants.au3>
    #include <WinAPI.au3>

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

    Global Const $MB_USERICON = 0x00000080

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

    ; --- $MSGBOXPARAMS
    Global Const $MSGBOXPARAMS = _
    "UINT cbSize;"& _
    "HWND hwndOwner;"& _
    "HANDLE hInstance;"& _
    "ptr lpszText;"& _
    "ptr lpszCaption;"& _
    "DWORD dwStyle;"& _
    "ptr lpszIcon;"& _
    "DWORD_PTR dwContextHelpId;"& _
    "ptr lpfnMsgBoxCallback;"& _
    "DWORD dwLanguageId;"

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

    Func MessageBoxIndirect ($lpMsgBoxParams)

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

    Local $aRes = DllCall ("user32.dll", "INT", "MessageBoxIndirectW", _
    "ptr", $lpMsgBoxParams)
    Return $aRes[0]

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

    EndFunc

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

    Func MyMsgBox ($hwnd, $text, $title, $style)

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

    Local $mbp = DllStructCreate ($MSGBOXPARAMS)
    Local $szText = DllStructCreate (StringFormat ("WCHAR [%d]", StringLen ($text)+1))
    Local $szTitle = DllStructCreate (StringFormat ("WCHAR [%d]", StringLen ($title)+1))
    Local $szIcon = DllStructCreate ("WCHAR [4]")

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

    DllStructSetData ($szText, 1, $text)
    DllStructSetData ($szTitle, 1, $title)
    DllStructSetData ($szIcon, 1, "#99") ; Resource ID from Icon Group (e.g. AutoIt-Icon)

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

    DllStructSetData ($mbp, "cbSize", DllStructGetSize ($mbp))
    DllStructSetData ($mbp, "hwndOwner", $hwnd)
    DllStructSetData ($mbp, "hInstance", _WinAPI_GetModuleHandle (0))
    DllStructSetData ($mbp, "lpszText", DllStructGetPtr ($szText))
    DllStructSetData ($mbp, "lpszCaption", DllStructGetPtr ($szTitle))
    DllStructSetData ($mbp, "dwStyle", BitOR ($style, $MB_USERICON))
    DllStructSetData ($mbp, "lpszIcon", DllStructGetPtr ($szIcon)) ; Icon ID
    DllStructSetData ($mbp, "dwContextHelpId", 0)
    DllStructSetData ($mbp, "lpfnMsgBoxCallback", 0)
    DllStructSetData ($mbp, "dwLanguageId", 0)

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

    MessageBoxIndirect (DllStructGetPtr ($mbp))

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

    EndFunc

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

    MyMsgBox (0, "Dies ist der Text", "Titel", $MB_OK)
    Exit (0)

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


    MessageBoxIndirect


    Gruß
    Greenhorn