Ping bei Msgbox ausschalten

  • Hallo zusammen,

    gibt es eine Möglichkeit bei einer MSGBOX Ausgabe das PING, also den Sound auszuschalten?

    Ich weiß, man kann über eine RegKey Eintrag den Ton abschalten. Ich möchte aber lieben bei bestimmten MSGBOX den Ton abschalten, bei anderen nicht.

    Habe in der Hilfe und bei der Suche nichts passendes gefunden, daher setze ich meiner Hoffnung auf euch!

    Gruß

    Steffen

    Einmal editiert, zuletzt von s.koni (5. Mai 2009 um 14:41)

  • Das geht in einer MsgBox nicht .
    Für ohne Sound kannst du dir ja eine GUI machen die wie eine MsgBox aussieht !

  • Wo ihrs grad so anspecht, ich mach mal noch ne Funktion zu meiner UDF, dass man den Sound ausschalten kann. ^^

    EDIT: Ok, hier meine neuste version. Jetz kann man die Sounds auch ausmachen.
    ( $SoundPlay = 0: Sounds aus ||| $SoundPlay = 1: Sounds an )

    Spoiler anzeigen
    [autoit]

    ; ==================================================================================================
    ;
    ; Name: _MsgBox
    ; Funktion: Eine einfach MsgBox, bei der man Position und Farbe ändern kann.
    ;
    ; Parameter: $Flag: Das Flag gibt an, wie die Box aussieht, und welche Buttons angezeigt werden.
    ; $ExFlag: Bestimmt, welches Icon angezeigt werden soll.
    ; $Titel: Titel der MsgBox.
    ; $Text: Text, der in der MsgBox stehen soll.
    ; $Left: X-Position der MsgBox. (-1 definiert die Mitte des Bildschirms)
    ; $Top: Y-Position der MsgBox. (-1 definiert die Mitte des Bildschirms)
    ; $Color: Hintergrundfarbe der MsgBox
    ; $OnTop: 1 = Bestimmt, dass die MsgBox immer im Vordergrund steht. (Standart = 0)
    ; $Sound: 1 = Bestimmt, dass der Sound an ist. (Standart = 1)
    ;
    ; ==================================================================================================
    #include <WindowsConstants.au3>
    Func _MsgBox ($Flag, $ExFlag, $Titel, $Text, $Left, $Top, $Color, $OnTop = 0, $SoundPlay = 1)
    Local $iOnEventMode = Opt("GUIOnEventMode", 0)
    Local $Size = 7
    Local $FontWidth = 700
    Local $return
    Local $Sound = @WindowsDir & "\Media\"
    $MsgGUI = GUICreate ($Titel, 245, 200, $Left, $Top)
    If $OnTop = 1 Then
    WinSetOnTop ($MsgGUI, "", 1)
    EndIf
    GUISetBkColor ($Color)
    GUISetIcon ("User32.dll", -1)
    GUISetState (@SW_SHOW, $MsgGUI)
    $MsgText = GUICtrlCreateLabel ($Text, 60, 10, 180, 160, 0x0800)
    GUICtrlSetBkColor (-1, $Color)
    ; -------------------------------------
    Switch $ExFlag
    Case 0
    GUICtrlCreateIcon ("User32.dll", -1, 10, 10, 32, 32)
    If $SoundPlay = 1 Then SoundPlay ($Sound & "Windows XP-Ping.wav")
    Case 16
    GUICtrlCreateIcon ("User32.dll", -4, 10, 10, 32, 32)
    If $SoundPlay = 1 Then SoundPlay ($Sound & "Windows XP-kritischer Fehler.wav")
    Case 32
    GUICtrlCreateIcon ("User32.dll", -3, 10, 10, 32, 32)
    If $SoundPlay = 1 Then SoundPlay ($Sound & "chimes.wav")
    Case 48
    GUICtrlCreateIcon ("User32.dll", -2, 10, 10, 32, 32)
    If $SoundPlay = 1 Then SoundPlay ($Sound & "Windows XP-Hinweis.wav")
    Case 64
    GUICtrlCreateIcon ("User32.dll", -5, 10, 10, 32, 32)
    If $SoundPlay = 1 Then SoundPlay ($Sound & "windows xp-informationsleiste.wav")
    EndSwitch
    ; -------------------------------------
    If $Flag = 0 Then
    $Button1 = GUICtrlCreateButton ("Ok", 85, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    While 1
    $Msg1 = GUIGetMsg ()
    Switch $msg1
    Case $Button1
    $return = 1
    ExitLoop
    Case -3
    $return = 2
    ExitLoop
    EndSwitch
    WEnd
    EndIf
    ; -------------------------------------
    If $Flag = 1 Then
    $Button2 = GUICtrlCreateButton ("Ok", 30, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    $Button3 = GUICtrlCreateButton ("Abbrechen", 140, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    While 1
    $Msg2 = GUIGetMsg ()
    Switch $msg2
    Case $Button2
    $return = 1
    ExitLoop
    Case $Button3
    $return = 2
    ExitLoop
    Case -3
    $return = 2
    ExitLoop
    EndSwitch
    WEnd
    EndIf
    ; -------------------------------------
    If $Flag = 2 Then
    $Button4 = GUICtrlCreateButton ("Abbrechen", 5, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    $Button5 = GUICtrlCreateButton ("Wiederhohlen", 85, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    $Button6 = GUICtrlCreateButton ("Ignorieren", 165, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    While 1
    $Msg3 = GUIGetMsg ()
    Switch $msg3
    Case $Button4
    $return = 2
    ExitLoop
    Case $Button5
    $return = 4
    ExitLoop
    Case $Button6
    $return = 5
    ExitLoop
    Case -3
    $return = 2
    ExitLoop
    EndSwitch
    WEnd
    EndIf
    ; -------------------------------------
    If $Flag = 3 Then
    $Button7 = GUICtrlCreateButton ("Ja", 5, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    $Button8 = GUICtrlCreateButton ("Nein", 85, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    $Button9 = GUICtrlCreateButton ("Abbrechen", 165, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    While 1
    $Msg4 = GUIGetMsg ()
    Switch $msg4
    Case $Button7
    $return = 6
    ExitLoop
    Case $Button8
    $return = 7
    ExitLoop
    Case $Button9
    $return = 2
    ExitLoop
    Case -3
    $return = 2
    ExitLoop
    EndSwitch
    WEnd
    EndIf
    ; -------------------------------------
    If $Flag = 4 Then
    $Button10 = GUICtrlCreateButton ("Ja", 30, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    $Button11 = GUICtrlCreateButton ("Nein", 140, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    While 1
    $Msg4 = GUIGetMsg ()
    Switch $msg4
    Case $Button10
    $return = 6
    ExitLoop
    Case $Button11
    $return = 7
    ExitLoop
    Case -3
    $return = 2
    ExitLoop
    EndSwitch
    WEnd
    EndIf
    ; -------------------------------------
    If $Flag = 5 Then
    $Button12 = GUICtrlCreateButton ("Wiederhohlen", 30, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    $Button13 = GUICtrlCreateButton ("Abbrechen", 140, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    While 1
    $Msg4 = GUIGetMsg ()
    Switch $msg4
    Case $Button12
    $return = 4
    ExitLoop
    Case $Button13
    $return = 2
    ExitLoop
    Case -3
    $return = 2
    ExitLoop
    EndSwitch
    WEnd
    EndIf
    ; -------------------------------------
    If $Flag = 6 Then
    $Button14 = GUICtrlCreateButton ("Abbrechen", 5, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    $Button15 = GUICtrlCreateButton ("Wiederhohlen", 85, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    $Button16 = GUICtrlCreateButton ("Weiter", 165, 175, 75, 20)
    GUICtrlSetFont (-1, $Size, $FontWidth)
    While 1
    $Msg4 = GUIGetMsg ()
    Switch $msg4
    Case $Button14
    $return = 2
    ExitLoop
    Case $Button15
    $return = 4
    ExitLoop
    Case $Button16
    $return = 11
    ExitLoop
    Case -3
    $return = 2
    ExitLoop
    EndSwitch
    WEnd
    EndIf ;==> Flags
    ; ---
    GUIDelete($MsgGUI)
    Opt("GUIOnEventMode", $iOnEventMode)
    Return($return)
    EndFunc ;==> _MsgBox
    ; ---
    ; ---
    ; ---
    ; BEISPIEL ( Um die Udf zu benutzen, entweder ab hier löschen, oder auskommentieren!
    _MsgBox (1, 0, "Titel der MsgBox", "Dies ist der Text, der in der MsgBox stehen soll." & @CRLF & @CRLF & "Das steht 2 Zeilen weiter.", -1, -1, 0x00FF00, 1, 0)

    [/autoit]

    Einmal editiert, zuletzt von Commander21 (5. Mai 2009 um 15:25)