VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



A miniature wave player using an API Call

by Brandon (46 Submissions)
Category: Sound/MP3
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Fri 15th June 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

A miniature wave player using an API Call

API Declarations


(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Rate A miniature wave player using an API Call



'the following code.
'make sure to use appropriate control names.
'Note:  The files I have used in this program come from files located
'on my hard drive in my systems folder, you may not have some or any
'of these files, best thing to do is search your harddrive for wave
'sound files (.wav extension) and use the correct path where the files
'are located and store it in the variable "Path."

Private Sub cmdSound_Click()
Dim FileName, Path, Destination As String
Dim PlayWave As Integer
'all files located in Windows sytem folder
'get sound file information
FileName = cboPlayList.Text
Path = "c:\WINDOWS\SYSTEM\"
Destination = Path & FileName
'make sure file exists
If cboPlayList.Text = vbNullString Or cboPlayList.Text = "Wave Play List" Then
    MsgBox "You must select a file from this list", vbInformation, "Error"
    cboPlayList.Text = "Wave Play List"
Else
    'play sound file
    PlayWave = sndPlaySound(ByVal CStr(Destination), 1)
End If
End Sub




Private Sub Form_Load()
'add files to play list
With cboPlayList
    .AddItem "PC.wav"
    .AddItem "Yhapp.wav"
    .AddItem "binklow.wav"
    .AddItem "ty.wav"
    .AddItem "lpnsf.wav"
    .AddItem "hctroub.wav"
    .AddItem "ccrash.wav"
End With
End Sub




Download this snippet    Add to My Saved Code

A miniature wave player using an API Call Comments

No comments have been posted about A miniature wave player using an API Call. Why not be the first to post a comment about A miniature wave player using an API Call.

Post your comment

Subject:
Message:
0/1000 characters