|
-
Nov 15th, 2001, 01:03 PM
#1
Thread Starter
Hyperactive Member
Playing Wav or System Beep
I'm trying to get my error MsgBox to play a wav or system beep when it opens. is there a way to do this without have to add .ocx's or apis?
-
Nov 15th, 2001, 01:05 PM
#2
You can just use the simple Beep statement.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Nov 15th, 2001, 01:07 PM
#3
-
Nov 16th, 2001, 06:41 PM
#4
Try that that funny:
VB Code:
Private Declare Function Beep Lib "kernel32" (ByVal dwFreq As Long, ByVal dwDuration As Long) As Long
Private Sub Form_Load()
Me.Visible = False
Dim Cnt As Long
For Cnt = 0 To 5000 Step 10
Beep Cnt, 50
Me.Caption = Cnt
DoEvents
Next Cnt
Unload Me
End Sub
-
Nov 16th, 2001, 06:50 PM
#5
You kinda have to use api's.
Play a wav file with PlaySound api
Code:
Private Const SND_APPLICATION = &H80 ' look for application specific association
Private Const SND_ALIAS = &H10000 ' name is a WIN.INI [sounds] entry
Private Const SND_ALIAS_ID = &H110000 ' name is a WIN.INI [sounds] entry identifier
Private Const SND_ASYNC = &H1 ' play asynchronously
Private Const SND_FILENAME = &H20000 ' name is a file name
Private Const SND_LOOP = &H8 ' loop the sound until next sndPlaySound
Private Const SND_MEMORY = &H4 ' lpszSoundName points to a memory file
Private Const SND_NODEFAULT = &H2 ' silence not default, if sound not found
Private Const SND_NOSTOP = &H10 ' don't stop any currently playing sound
Private Const SND_NOWAIT = &H2000 ' don't wait if the driver is busy
Private Const SND_PURGE = &H40 ' purge non-static events for task
Private Const SND_RESOURCE = &H40004 ' name is a resource name or atom
Private Const SND_SYNC = &H0 ' play synchronously (default)
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Sub Command1_Click()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: [email protected]
PlaySound "C:\WINDOWS\MEDIA\TADA.WAV", ByVal 0&, SND_FILENAME Or SND_ASYNC
End Sub
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
|