so that I can determine when it is done playing the current audio file.
The intent would be to poll the status until it is complete,
but if someone knows how to have an event procedure activate when it happens,that would be better.
System: Windows 7 32 bit, MS Access 2007, VBA
In the FORM there is a control named WindowsMediaPlayer1 which is from the collection of ActiveX Controls
In the FORM there is a button named B_Audio
In the FORM there is a button named B_Status
In the CODE for the FORM there are the following routines:
Expand|Select|Wrap|Line Numbers
- Dim myPlayer As WindowsMediaPlayer
- Dim myControlAndStatus As IWMPEvents4
- Private Sub B_Audio_Click()
- Rem Description
- Rem Play Audio File Using Windows Media Player
- Dim myFilename As String
- Rem Note: WindowsMediaPlayer1 is an Active-X Control in Form
- Set myPlayer = Me.WindowsMediaPlayer1.Object
- Rem Select Filename to Play using File Select Dialog
- myFilename = DialogSelectFile("Select Audio File", "Audio Files", "*.wav;*.mp3")
- Rem Open the Player Using the Selected File
- myPlayer.openPlayer myFilename
- End Sub
- Private Sub B_Status_Click()
- Debug.Print "PlayState=" & myPlayer.PlayState
- Debug.Print "OpenState=" & myPlayer.OpenState
- End Sub
Click on the B_Audio button, select a file using the File Select Dialog
The Windows Media Player starts up and plays the audio file.
Click on the B_Status button, but information from myPlayer.PlayState or myPlayer.OpenState is NOT CORRECT
Can someone tell me what the magic secret is here to getting this status info
I also tried using an object myControlAndStatus but don't know how to instantiate it with a VB set statement.
Thanks...