Msgbox Ja Nei Ja,alle

  • Hallo,


    kann ich die Beschriftung der Buttons in eienr MsgBox ändern? Ich hätt egerne eine Msgbox mit Ja/Nein/Ja Alle/Abbruch

    oder gibt es da eine andere Möglichkeit.


    Danke udn Grüsse

  • Um das zu haben muss dur die eine eigene MsgBox via GUI "bauen".

    Andy hat mir ein Schnitzel gebacken aber da war ein Raupi drauf und bevor Oscar das Bugfixen konnte kam Alina und gab mir ein AspirinJunkie.

  • Hier mal ein Beispiel mittels CbtHook 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]
  • Moin.

    Sicherlich ausbaufähig, aber kannst ja erst einmal schauen:

    Spoiler anzeigen
    [autoit]


    ; Script startet

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

    #include <Misc.au3>
    $MsgBoxValue = _MsgBoxChangeButtons(4, 'This is my msgbox', 'This' & @CRLF & 'Should' & @CRLF & 'Work', 'ReBoot', 'Continue')
    If $MsgBoxValue = 6 Then
    MsgBox(0, 'Clicked', 'You clicked the ReBoot Button')
    Else
    MsgBox(0, 'Clicked', 'You clicked the Continue Button')
    EndIf
    Func _MsgBoxChangeButtons($iFlag, $sTitle, $sText, $sButton1, $sButton2 = '', $sButton3 = '', $iMBTimeOut = 0)
    Local $MBFile = FileOpen(@TempDir & '\MiscMMB.txt', 2)
    Local $MBLine1 = 'While Not WinExists("' & $sTitle & '")'
    Local $MBLine2 = ' Sleep(10)'
    Local $MBLine3 = 'WEnd'
    Local $MBLine4 = 'ControlSetText("' & $sTitle & '", "", "Button1", "' & $sButton1 & '")'
    Local $MBLine5 = 'ControlSetText("' & $sTitle & '", "", "Button2", "' & $sButton2 & '")'
    Local $MBLine6 = 'ControlSetText("' & $sTitle & '", "", "Button3", "' & $sButton3 & '")'
    If $sButton2 = '' Then
    FileWrite(@TempDir & '\MiscMMB.txt', $MBLine1 & @CRLF & $MBLine2 & @CRLF & $MBLine3 & @CRLF & $MBLine4)
    ElseIf $sButton2 <> '' And $sButton3 = '' Then
    FileWrite(@TempDir & '\MiscMMB.txt', $MBLine1 & @CRLF & $MBLine2 & _
    @CRLF & $MBLine3 & @CRLF & $MBLine4 & @CRLF & $MBLine5)
    ElseIf $sButton2 <> '' And $sButton3 <> '' Then
    FileWrite(@TempDir & '\MiscMMB.txt', $MBLine1 & @CRLF & $MBLine2 & @CRLF & _
    $MBLine3 & @CRLF & $MBLine4 & @CRLF & $MBLine5 & @CRLF & $MBLine6)
    EndIf
    $MBPID1 = Run(@AutoItExe & ' /AutoIt3ExecuteScript ' & EnvGet('TEMP') & '\MiscMMB.txt')
    $MBBox = MsgBox($iFlag, $sTitle, $sText, $iMBTimeOut)
    FileClose($MBFile)
    Do
    FileDelete(@TempDir & '\MiscMMB.txt')
    Until Not FileExists(@TempDir & '\MiscMMB.txt')
    Return $MBBox
    EndFunc

    [/autoit]

    Das ganze mit drei Buttons:

    Spoiler anzeigen
    [autoit]


    $MsgBoxValue = _MsgBoxChangeButtons(3, 'This is my msgbox', 'This' & @CRLF & 'Should' & @CRLF & 'Work', 'Re-Boot', 'Con-Tinue', 'E-Gal 88 66')
    If $MsgBoxValue = 6 Then MsgBox(0, 'Clicked', 'You clicked the ReBoot Button')
    If $MsgBoxValue = 1 Then MsgBox(0, 'Clicked', 'You clicked the 1ReBoot Button')
    If $MsgBoxValue = 2 Then MsgBox(0, 'Clicked', 'You clicked the E-Gal 88 69 Button')
    If $MsgBoxValue = 3 Then MsgBox(0, 'Clicked', 'You clicked the Re3Boot Button')
    If $MsgBoxValue = 4 Then MsgBox(0, 'Clicked', 'You clicked the ReB4oot Button')
    If $MsgBoxValue = 5 Then MsgBox(0, 'Clicked', 'You clicked the ReBo5ot Button')
    If $MsgBoxValue = 7 Then MsgBox(0, 'Clicked', 'You clicked the Con-Tinue Button')

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

    Func _MsgBoxChangeButtons($iFlag, $sTitle, $sText, $sButton1, $sButton2 = '', $sButton3 = '', $iMBTimeOut = 0)
    Local $MBFile = FileOpen(@TempDir & '\MiscMMB.txt', 2)
    Local $MBLine1 = 'While Not WinExists("' & $sTitle & '")'
    Local $MBLine2 = ' Sleep(10)'
    Local $MBLine3 = 'WEnd'
    Local $MBLine4 = 'ControlSetText("' & $sTitle & '", "", "Button1", "' & $sButton1 & '")'
    Local $MBLine5 = 'ControlSetText("' & $sTitle & '", "", "Button2", "' & $sButton2 & '")'
    Local $MBLine6 = 'ControlSetText("' & $sTitle & '", "", "Button3", "' & $sButton3 & '")'
    If $sButton2 = '' Then
    FileWrite(@TempDir & '\MiscMMB.txt', $MBLine1 & @CRLF & $MBLine2 & @CRLF & $MBLine3 & @CRLF & $MBLine4)
    ElseIf $sButton2 <> '' And $sButton3 = '' Then
    FileWrite(@TempDir & '\MiscMMB.txt', $MBLine1 & @CRLF & $MBLine2 & _
    @CRLF & $MBLine3 & @CRLF & $MBLine4 & @CRLF & $MBLine5)
    ElseIf $sButton2 <> '' And $sButton3 <> '' Then
    FileWrite(@TempDir & '\MiscMMB.txt', $MBLine1 & @CRLF & $MBLine2 & @CRLF & _
    $MBLine3 & @CRLF & $MBLine4 & @CRLF & $MBLine5 & @CRLF & $MBLine6)
    EndIf
    $MBPID1 = Run(@AutoItExe & ' /AutoIt3ExecuteScript ' & EnvGet('TEMP') & '\MiscMMB.txt')
    $MBBox = MsgBox($iFlag, $sTitle, $sText, $iMBTimeOut)
    FileClose($MBFile)
    Do
    FileDelete(@TempDir & '\MiscMMB.txt')
    Until Not FileExists(@TempDir & '\MiscMMB.txt')
    Return $MBBox
    EndFunc

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

    ;MsgBox

    [/autoit]

    Lieben Gruß,
    Alina

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Geheime Information: ;)
    k3mrwmIBHejryPvylQSFieDF5f3VOnk6iLAVBGVhKQegrFuWr3iraNIblLweSW4WgqI0SrRbS7U5jI3sn50R4a15Cthu1bEr