|
-
June 23rd, 2001, 01:18 AM
#1
What is the error?
The program is design to play sound.
when I select a .wav or .midi file to play,there is an error that is "the function is undeclared",but why?
Is there any errors when I use the playsound(...)function?
the code is as follow:
Private Sub Drive1_Change()
On Error GoTo check
Dir1.Path = Drive1.Drive
Exit Sub
check:
MsgBox "The driver is unavailable!"
Drive1.Drive = "c:\"
Resume Next
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Command1_Click()
Dim filename As String
Dim Error As Long
If Right(File1.Path, 1) = "\" Then
filename = File1.Path + File1.filename
Else
filename = File1.Path + "\" + File1.filename
End If
Error = PlaySound(filename, 0, SND_FILENAME Or SND_SYNC)
End Sub
-
June 23rd, 2001, 01:56 AM
#2
Re: What is the error?
you need to declare it cause it is API, like this
Public Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
HTH
cksiow
http://vblib.virtualave.net - share our codes
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
|