Jump to content

how to add music and Icon like message box ...


Recommended Posts

hi,

anyone will tell me how can i add sound and icon in this.

$M1 = "WARNING !!!"
$MESSAGE = "Adult Content Detected." & @CRLF & @CRLF & "Open Something Else..." & @CRLF & @CRLF & "You FOOL !!!" & @CRLF & @CRLF & "Press OK To Continue..."
Func ColorTextBox($title,$text,$color)
    Local $L_TEXT = StringLen($text)
    Local $ROW = Int(Number($L_TEXT) / 45) + 1
    Local $GUI = GUICreate($title,200,40*Number($ROW) + 30,-1,-1)
    Local $FIELD = GUICtrlCreateLabel($text,5,5,190,42*Number($ROW),0x01)
    Local $OK = GUICtrlCreateButton("OK",130,40*Number($ROW) + 0,55,25)
    GUICtrlSetColor ($FIELD,$color)
    GUISetState(@SW_SHOW,$GUI)
    While 1
        Local $MSG = GUIGetMsg()
        If $MSG = $OK Then
            GUIDelete($GUI)
            ExitLoop
        EndIf
    WEnd
EndFunc
if WinExists("") Then
    ColorTextBox($M1, $MESSAGE,0xFF0000)
EndIf

any suggestions or comments are welcomed!

thanks in advance for the help.

Edited by GsmExpert
Link to comment
Share on other sites

couldn't find exact icon, sry :)

$M1 = "WARNING !!!"
$MESSAGE = "Adult Content Detected." & @CRLF & @CRLF & "Open Something Else..." & @CRLF & @CRLF & "You FOOL !!!" & @CRLF & @CRLF & "Press OK To Continue..."
Func ColorTextBox($title,$text,$color)
    Local $L_TEXT = StringLen($text)
    Local $ROW = Int(Number($L_TEXT) / 45) + 1
    Local $GUI = GUICreate($title,200,40*Number($ROW) + 30,-1,-1)
    Local $icon = GUICtrlCreateIcon("shell32.dll", "338", 20, 115)
    Local $FIELD = GUICtrlCreateLabel($text,5,5,190,30*Number($ROW),0x01)
    Local $OK = GUICtrlCreateButton("OK",130,40*Number($ROW) + 0,55,25)
    GUICtrlSetColor ($FIELD,$color)
    GUISetState(@SW_SHOW,$GUI)
    SoundPlay(@WindowsDir & "\media\Windows XP Critical Stop.wav",1)
    While 1
        $MSG = GUIGetMsg()
        If $MSG = $OK Then
            GUIDelete($GUI)
            ExitLoop
        EndIf
    WEnd
EndFunc
if WinExists("") Then
    ColorTextBox($M1, $MESSAGE,0xFF0000)
EndIf
Link to comment
Share on other sites

ok, thanks!

will you please tell me how can i set the sound volume to maximum of this sound play.

using

SoundSetWaveVolume(100)

i want that it should play the sound with maximum available sound percentage.

can you tell me how can i do it ?

thanks.

Link to comment
Share on other sites

$M1 = "WARNING !!!"
$MESSAGE = "Adult Content Detected." & @CRLF & @CRLF & "Open Something Else..." & @CRLF & @CRLF & "You FOOL !!!" & @CRLF & @CRLF & "Press OK To Continue..."
Func ColorTextBox($title,$text,$color)
    Local $L_TEXT = StringLen($text)
    Local $ROW = Int(Number($L_TEXT) / 45) + 1
    Local $GUI = GUICreate($title,200,40*Number($ROW) + 60,-1,-1)
    Local $icon = GUICtrlCreateIcon("user32.dll",-4, 20, 40*Number($ROW))
    Local $FIELD = GUICtrlCreateLabel($text,5,5,190,30*Number($ROW),0x01)
    Local $OK = GUICtrlCreateButton("OK",130,40*Number($ROW) + 10,55,25)
    GUICtrlSetColor ($FIELD,$color)
    GUISetState(@SW_SHOW,$GUI)
    SoundPlay(@WindowsDir & "\media\Windows XP Critical Stop.wav",1)
    While 1
        $MSG = GUIGetMsg()
        If $MSG = $OK Then
            GUIDelete($GUI)
            ExitLoop
        EndIf
    WEnd
EndFunc
if WinExists("") Then
    ColorTextBox($M1, $MESSAGE,0xFF0000)
EndIf

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

#include <Audio.au3>

$M1 = "WARNING !!!"
$MESSAGE = "Adult Content Detected." & @CRLF & @CRLF & "Open Something Else..." & @CRLF & @CRLF & "You FOOL !!!" & @CRLF & @CRLF & "Press OK To Continue..."

Func ColorTextBox($title,$text,$color)
    Local $L_TEXT = StringLen($text)
    Local $ROW = Int(Number($L_TEXT) / 45) + 1
    Local $GUI = GUICreate($title,200,40*Number($ROW) + 60,-1,-1)
    Local $icon = GUICtrlCreateIcon("user32.dll",-4, 20, 40*Number($ROW))
    Local $FIELD = GUICtrlCreateLabel($text,5,5,190,30*Number($ROW),0x01)
    Local $OK = GUICtrlCreateButton("OK",130,40*Number($ROW) + 10,55,25)
    GUICtrlSetColor ($FIELD,$color)
    GUISetState(@SW_SHOW,$GUI)
    _SoundSetMasterVolume(100)
    SoundSetWaveVolume(100)
    SoundPlay(@WindowsDir & "\media\Windows XP Critical Stop.wav",1)
    While 1
        $MSG = GUIGetMsg()
        If $MSG = $OK Then
            GUIDelete($GUI)
            ExitLoop
        EndIf
    WEnd
EndFunc

if WinExists("") Then
    ColorTextBox($M1, $MESSAGE,0xFF0000)
EndIf

Search Audio.au3 on forum. Designed by Gary Frost, RazerM, Xenobiologist, and a little help from Volly

When the words fail... music speaks.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...