473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

MS Access VBA Use of Windows Media Player - Getting WMP Status ?

I am trying to get the status of a Windows Media Player object without success,
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
  1. Dim myPlayer As WindowsMediaPlayer
  2. Dim myControlAndStatus As IWMPEvents4
  3.  
  4. Private Sub B_Audio_Click()
  5. Rem Description
  6. Rem Play Audio File Using Windows Media Player
  7.  
  8. Dim myFilename As String
  9.  
  10. Rem Note: WindowsMediaPlayer1 is an Active-X Control in Form
  11. Set myPlayer = Me.WindowsMediaPlayer1.Object
  12.  
  13. Rem Select Filename to Play using File Select Dialog
  14. myFilename = DialogSelectFile("Select Audio File", "Audio Files", "*.wav;*.mp3")
  15.  
  16. Rem Open the Player Using the Selected File
  17. myPlayer.openPlayer myFilename
  18.  
  19. End Sub
  20.  
  21. Private Sub B_Status_Click()
  22.  
  23. Debug.Print "PlayState=" & myPlayer.PlayState
  24. Debug.Print "OpenState=" & myPlayer.OpenState
  25.  
  26. End Sub
  27.  
Test Procedure:
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...
Jun 5 '12 #1
0 2006

Sign in to post your reply or Sign up for a free account.

Similar topics

56
by: alan b | last post by:
I copied it and tried to edit the movie.htm below in the <PARAM NAME=*** location of the file where the videoclip is on my hard drive. It is already recorded by Windows Media Player. My version...
1
by: Anise | last post by:
I have a question concerning embedding a windows media player into a web application in .net.. I download Windows Media Player 10 and its SDK On the .ascx page I placed a windows media player...
1
by: Stephen Adam | last post by:
Hi there, Have spent a while trying to find out how to connect to Windows Media Player through COM. Unfortunately there doesnt seem to be much stuff about it on the web. What I need to do is...
0
by: icho | last post by:
Hi, I got a windows media player in an aspx page, which accesses files from a network share. I've maintain a connection using WNetAddConnection2 method of the windows API, but somehow the...
1
by: Paul Fi | last post by:
how do i catch windows explorer and windows media player events in a .NET application, is it possible, say i double clicked on a media file inside windows media player and i wanted that event to...
3
by: UJ | last post by:
I have a .avi file that uses the Divx codec. If I load it with windows media player program it works fine. If I load it using my control in a program, it doesn't display. Over standard media files...
5
by: Paul Fi | last post by:
I have this code which tries to obtain the number of items in the current playlist of windows media player: private void MainForm_Load(object sender, System.EventArgs e) { // get Window handle...
1
by: Sirmarty | last post by:
I am using the visual express edition 20005 for C#. I am trying to write a program which will randomly play songs weighted by a 0 to 100 rating scale. I can player a single song using the windows...
19
by: Tony | last post by:
I'm working on project that plays movies using Windows Media Player and I'm controlling everything with JavaScript. Per the client I only need to support IE 6 or greater which happens to make...
7
matheussousuke
by: matheussousuke | last post by:
I spent about 3 weeks on this. First I tried WMP embedded, didnt work (active x issue), then JW PLayer, didnt work too, then Flow Player, then Jw wmv player silver light (Yehaa, it worked,...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.