Afspille lyd i msgbox?

Tags:    visual-basic

Jah, som overskriften lyder..
Kan man?



2 svar postet i denne tråd vises herunder
2 indlæg har modtaget i alt 2 karma
Sorter efter stemmer Sorter efter dato
Søg efter PlaySound på msdn (http://www.msdn.com).
Du kan ikke afspille lyde MED messagebox, men du kan afspille via dit program.

1101110100010110000101000001

Husk, det kræver 42 muskler at se sur ud, det kræver kun 6 at slå idioten ned...



Her
=================

'Start standard Windows-lyd:

ret = sndPlaySound("SystemStart", SND_ASYNC)

'Start en vilkårligt placeret lyd:

ret = sndPlaySound("C:\\lyd.wav", SND_ASYNC)

'Windows-standardlyde
'LYDNAVN VB NAVN
'__________________________________________
'Afslut windows: "SystemExit"
'Gendan fra maximeret: "RestoreDown"
'Gendan fra minimeret: "RestoreUp"
'Kritisk stop: "SystemHand"
'Luk program: "Close"
'Maximer: "Maximize"
'Meddelelse om ny post: "?"
'Menucommando: "MenuCommand"
'Minimer: "Minimize"
'Pump-op-menu: "MenuPopUp"
'Programfejl: "AppGPFault"
'Spørgsmål: "SystemQuestion"
'Standartlyd: "SystemDefault"
'Start Windows: "SystemStart"
'Stjerne: "SystemAsterisk"
'Udråbstegn: "SystemExclamation"
'Åben program: "Open"
'Tøm papirkurv: "?"
'-------------------------------------------

'Denne del skal ind i et almindeligt modul før det virker:

'32-bit Declares for PlaySound & sndPlaySound
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
'The parameter lpszSoundName is the path & filename of the WAV file
'you want to play. uFlags is used to specify different ways to play
'the sound. See the constants below.

Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
'The parameter lpszName is the path & filename of the WAV file you
'want to play. hModule is the name of the module where the sound
'resource can be found if the sound is part of a resource file.
'dwFlags is used to specify the type of sound lpszName specifies.


'Beskrivelse til delen i modulet:

'Constants used by the uFlags parameter
Public Const SND_SYNC = &H0 'The sound is played synchronously. The
'function does not return until the sound ends.
Public Const SND_ASYNC = &H1 'The sound is played asynchronously. The
'function returns immediately after beginning
'the sound. To terminate an asynchronously
'played sound, call SndPlaySound with
'lpszSoundName set to ""
Public Const SND_NODEFAULT = &H2 'If the specified sound cannot be played, the
'function does not play the default sound.
Public Const SND_MEMORY = &H4 'The parameter specified by lpszSoundName
'points to an in-memory image of a wave-
'form sound. Use this if your sounds are part
'of a resource file.
Public Const SND_LOOP = &H8 'The sound continues to play repeatedly until
'sndPlaySound is called again with
'lpsSoundName set to "". You must also
'specify the SND_ASYNC flag to loop
'sounds.
Public Const SND_NOSTOP = &H10 'If a sound is currently playing, the function
'immediately returns FALSE without playing
'the specified sound.



Håber det kan bruges! :D

Med Venlig Hilsen
Morten Torndahl Pedersen



t