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
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".
Hier mal ein Beispiel mittels CbtHook aus meiner FunSkin-UDF:
#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)
Local $iRet = MsgBox(34, "Select example", "Please select the skin you want to try")
[/autoit] [autoit][/autoit] [autoit]_WinAPI_UnhookWindowsHookEx($hHookMsgBox)
DllCallbackFree($hProcMsgBox)
#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
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
;##########################################################
#endregion Just for fun!!
Moin.
Sicherlich ausbaufähig, aber kannst ja erst einmal schauen:
; Script startet
#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
Das ganze mit drei Buttons:
$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')
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
;MsgBox
[/autoit]Alina: Das funktioniert zwar, die Lösung von funkey ist aber besser