How to Play a Wave File in VB6

By | 2019-09-25

With wave (.WAV) files, you can create voice responses and other audio interaction in your program. Playing wave files in your program is easy, as demonstrated here.

Module

Option Explicit

Public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
    (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long

Usage

Option Explicit

Private Sub Command1_Click()
    sndPlaySound "C:\WINDOWS\MEDIA\Start.wav", &H1
End Sub

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.