How do I get the Windows MoviePlayer to show a position scrubber?

I’m using a MoviePlayer to play an MP3 file in a window. I want the user to be able to play/pause, change the volume, and change the playhead position with a scrubber.

On Mac, this works fine; I just have a short (24 pixels high) MoviePlayer control in my window, and it provides a nice UI for those functions. On Windows, however, it provides play/pause and volume, but no position scrubber.

I’ve looked through the OLE documentation for Windows Media Player, but if there is some incantation in there that causes a position scrubber to appear, I can’t figure it out. I even got desperate enough to try to manually hook up a slider for this function, but that too works on Mac but fails on Windows (my attempts to set the MoviePlayer position from code appear to have no effect).

Surely I’m missing something… a movie/music player that doesn’t let the user control the position seems crude at best. How do I make this work?

Make sure the MoviePlayer.Controller property is set to Full ?

Not sure if that is what you are referring to.

Hi Joe,

I couldn’t figure out how to change the position of the played file as you mentioned. The command WindowsMediaPlayer.controls.currentposition = 60 with the WMPlayer.OCX did not change anything. The following comment from Microsoft might possibly provide some information:

Re-establishing a Remote Connection In certain circumstances, the connection between a remoted, embedded control and the standalone Player will fail, invalidating your pointers to the Windows Media Player interfaces. Windows Media Player will automatically attempt to reconnect, and will fire the PlayerReconnect event to signal this attempt. Although the reconnection is automatic, you must provide an event handler for this event if you want to release your invalid pointers and retrieve new ones so that you can access the standalone Player through the new connection.

Remoting Windows Media Player Control

Once the updated pointer is retrieved, then the program should (might? maybe?) get control of the Windows Media Player for changing volume and current position of the played file. I ran out of time to try this tonight.

Hi Joe,

The good news is that I found out what needs to be done to control the Windows Media Player. The bad news is that ‘remoting the Windows Media Player’ is very poorly documented and is needed to control the player.

To increase, decrease, or mute the volume, I use this code snippet which controls Windows global volume control:

Sub Action() Handles Action Declare sub keybd_event Lib "User32.dll" (bVk as Byte, bScan as Byte, dwflags as Int32, dwExtraInfo as Int32) const VK_VOLUME_UP = &HAF const VK_VOLUME_DOWN = &HAE const VK_VOLUME_MUTE = &HAD call keybd_event(VK_VOLUME_UP, 0, 1, 0) //Use the appropriate constant End Sub