'This program will play a wav file on startup. 'It also plays the wav again on form_click 'It uses the MMcontrol object 'Start a new VB4 project and add: ' MMcontrol 'if the MMcontrol is not on your toolbox - right click the toolbox ' and select Custom Controls then slect 'Microsoft Multilmedia Control'. ' 'Then (Paste the following into (General)(declarations) ' #If Win32 Then Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long #ElseIf Win16 Then Private Declare Function GetWindowsDirectory Lib "Kernel" (ByVal lpBuffer As String, ByVal nSize As Integer) As Integer #End If Dim WinPath As String Function WindowsDirectory() As String WinPath = String(145, Chr(0)) WindowsDirectory = Left(WinPath, GetWindowsDirectory(WinPath, Len(WinPath))) End Function Private Sub Form_Click() ' Rewind the MCI WaveAudio device. Me.MMControl1.Command = "Prev" ' Play the MCI WaveAudio device. Me.MMControl1.Command = "Play" End Sub Private Sub Form_GotFocus() ' Show what Just happened Me.Print WindowsDirectory() & "\media\chimes.wav just played" & vbCrLf & "click the form to hear again" End Sub Private Sub Form_Load() ' Hide the MCI control (this can be done at design time) Me.MMControl1.Visible = False ' Set properties needed by MCI to open. Me.MMControl1.Notify = False Me.MMControl1.Wait = True Me.MMControl1.Shareable = False Me.MMControl1.DeviceType = "WaveAudio" ' Change the following line to point to a valid wav on your PC ' I look for \media\chimes.wav in your Windows dir Me.MMControl1.filename = WindowsDirectory() & "\media\chimes.wav" ' Open the MCI WaveAudio device. Me.MMControl1.Command = "Open" ' Play the MCI WaveAudio device. Me.MMControl1.Command = "Play" End Sub