|
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Namespace MCIDEMO
Public Partial Class Form2
Inherits Form
' Declare the nofify constant
Public Const MM_MCINOTIFY As Integer = 953
Public Const MCI_NOTIFY_SUCCESSFUL As Integer = 1
Public Const NOTIFY_ABORTED As Integer = 4
Public parent As Form
Protected Overrides Sub WndProc(ByRef m As Message)
If m.Msg = MM_MCINOTIFY Then
' The file is done playing, do whatever
System.Diagnostics.Debug.WriteLine(m.ToString())
For Each itm As Form1.ListItem In DirectCast(Me.parent, Form1).listBox1.Items
If itm.DeviceId = CInt(m.LParam) Then
'To handle wav file play looping
If (itm.Filename.Substring(itm.Filename.Length - 4).ToUpper() = ".WAV") AndAlso (CInt(m.WParam) = MCI_NOTIFY_SUCCESSFUL) AndAlso (itm.Playlooping) Then
Dim p As New MciPlayer()
p.[Alias] = itm.[Alias]
p.Isloaded = True
p.PlayFromStart(Me.Handle)
Exit For
Else
listBox1.Items.Add(DateTime.Now.ToString() & " " & DirectCast(itm.Filename, String))
Exit For
End If
End If
Next
End If
MyBase.WndProc(m)
End Sub
Public Sub New()
InitializeComponent()
End Sub
Private Sub listBox1_SelectedIndexChanged(sender As Object, e As EventArgs)
End Sub
End Class
End Namespace
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Coder. Hacker. Fixer.