|
-
May 17th, 2004, 03:24 PM
#1
Thread Starter
New Member
playing a sound
Hello people,
i was just wondering if anyone knew how i could play a sound off my programe, i want a sound file to play when a winner on my program gets the jackpot!
my code atm is
VB Code:
If TotalWinner6 = 6 Then
MessageBox.Show("Winner!!! MILLIONAIRE!!! for " & objCurrentRow("LastName"))
End If
Any help on this would be very gratful
Cheers
Mikey
-
May 17th, 2004, 04:20 PM
#2
take a look at the PlaySound Api , here's a quick example i knocked together for you ...
VB Code:
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Int32, ByVal dwFlags As Int32) As Int32
Private Const SND_FILENAME As Int32 = &H20000
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim TotalWinner6 As Integer = 6
If TotalWinner6 = 6 Then
Dim thrd As New Threading.Thread(AddressOf WinnerSound)
thrd.Start() '/// set a new thread to play the sound file ( to allow the message box to show at the same time as the sound plays )
MessageBox.Show("we have a winner!")
End If
End Sub
Private Sub WinnerSound()
PlaySound("C:\WINDOWS\MEDIA\Windows XP Startup.wav", 0, SND_FILENAME)
End Sub
~
if a post is resolved, please mark it as [Resolved]
protected string get_Signature(){return Censored;}
[vbcode][php] please use code tags when posting any code [/php][/vbcode]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|