MsgBox - Beschreibung der Buttons

  • Juhuu, kann endlich Mal was sinvolles beitragen, statt nur mit Fragen zu nerven :D

    In einem im Koda-Form-Designer erstellten GUI kannste super die Buttons (Bezeichnung) unter "Caption" anpassen..

    Spoiler anzeigen

    [Blockierte Grafik: http://mm-edv.eu/AutoIT/koda.jpg]

    Kannst auch erst `nen "Ja"-Button basteln und später im Skript anpassen:

    Spoiler anzeigen

    #include <GUIConstants.au3>

    #Region ### START Koda GUI section ### Form=
    $Form1 = GUICreate("Form1", 625, 443, 193, 125)
    $Button1 = GUICtrlCreateButton("Drück mich endlich, damit`s endlich losgeht :D", 24, 16, 553, 41, 0)
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
    Case $GUI_EVENT_CLOSE
    Exit

    EndSwitch
    WEnd

    LG Mike

    #EDIT Hauke war schneller :P

    #EDIT2 Grad "_GUICtrlButton_Create" Inner Hilfe gefunden, evtl hilfts ja auch weiter ;)

  • Mit Forensuche in 5 Sekunden gefunden:

    [autoit]

    Func _MsgBoxIndividual($flag, $title, $text, $btn_text1 = "&OK", $btn_text2 = "&Nein", $btn_text3 = "&Vielleicht", $TimeOut = 0)
    Local $str = "Local $x = Opt('WinWaitDelay',50)+WinWait('" & $title & "','')+" & _
    "ControlSetText('" & $title & "','" & $text & "','Button1','" & $btn_text1 & "')+" & _
    "ControlSetText('" & $title & "','" & $text & "','Button2','" & $btn_text2 & "')+" & _
    "ControlSetText('" & $title & "','" & $text & "','Button3','" & $btn_text3 & "')"
    Run('"' & @AutoItExe & '" /AutoIt3ExecuteLine "' & $str & '"')
    Sleep(100)
    Return MsgBox($flag, $title, $text, $TimeOut)
    EndFunc ;==>_MsgBoxIndividual
    _MsgBoxIndividual(34, "Frage", "Gehst du heute mit mir aus?", "&Bin dabei", "&Mag nicht")

    [/autoit]


    Bedank dich bei funkey bzw. AutoBert

    Twitter: @L3viathan2142
    Benutze AutoIt persönlich nicht mehr, da ich keinen Windows-Rechner mehr besitze.

  • Klappt es, wenn du das Sleep(100) weglässt?
    Bzw. so:

    Spoiler anzeigen
    [autoit]


    Func _MsgBoxIndividual($flag, $title, $text, $btn_text1 = "&OK", $btn_text2 = "&Nein", $btn_text3 = "&Vielleicht", $TimeOut = 0)
    Local $str = "Local $x = Opt('WinWaitDelay',80)+WinWait('" & $title & "','')+" & _
    "ControlSetText('" & $title & "','" & $text & "','Button1','" & $btn_text1 & "')+" & _
    "ControlSetText('" & $title & "','" & $text & "','Button2','" & $btn_text2 & "')+" & _
    "ControlSetText('" & $title & "','" & $text & "','Button3','" & $btn_text3 & "')"
    Run('"' & @AutoItExe & '" /AutoIt3ExecuteLine "' & $str & '"')
    Sleep(100)
    Return MsgBox($flag, $title, $text, $TimeOut)
    EndFunc ;==>_MsgBoxIndividual
    _MsgBoxIndividual(34, "Frage", "Gehst du heute mit mir aus?", "&Bin dabei", "&Mag nicht")

    [/autoit]

    Twitter: @L3viathan2142
    Benutze AutoIt persönlich nicht mehr, da ich keinen Windows-Rechner mehr besitze.

  • Die Methode mittels CBTHook ist die beste! Die andere Variante funktioniert leider nicht immer.

    Hier ein Beispiel aus meiner FunSkin-UDF:

    Spoiler anzeigen
    [autoit]

    #include <WinAPI.au3>

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

    Local $hProcMsgBox = DllCallbackRegister("CbtHookProcMsgBox", "int", "int;int;int")
    Local $TIDMsgBox = _WinAPI_GetCurrentThreadId()
    Local $hHookMsgBox = _WinAPI_SetWindowsHookEx($WH_CBT, DllCallbackGetPtr($hProcMsgBox), 0, $TIDMsgBox)

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

    Local $iRet = MsgBox(34, "Select example", "Please select the skin you want to try")

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

    _WinAPI_UnhookWindowsHookEx($hHookMsgBox)
    DllCallbackFree($hProcMsgBox)

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

    #region Just for fun!!
    ;##########################################################
    Func CbtHookProcMsgBox($nCode, $wParam, $lParam)
    Local $RET = 0, $hBitmap = 0, $xWnd = 0
    If $nCode < 0 Then
    $RET = _WinAPI_CallNextHookEx($hHookMsgBox, $nCode, $wParam, $lParam)
    Return $RET
    EndIf
    Switch $nCode
    Case 5 ;5=HCBT_ACTIVATE
    _WinAPI_SetDlgItemText($wParam, 3, "1")
    _WinAPI_SetDlgItemText($wParam, 4, "2")
    _WinAPI_SetDlgItemText($wParam, 5, "3")
    EndSwitch
    Return
    EndFunc ;==>CbtHookProcMsgBox

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

    Func _WinAPI_SetDlgItemText($hDlg, $nIDDlgItem, $lpString)
    Local $aRet = DllCall('user32.dll', "int", "SetDlgItemText", _
    "hwnd", $hDlg, _
    "int", $nIDDlgItem, _
    "str", $lpString)
    Return $aRet[0]
    EndFunc ;==>_WinAPI_SetDlgItemText

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

    ;##########################################################
    #endregion Just for fun!!

    [/autoit]