Windows Media Player 9 with win32com.client.Dispatch?

Mickel Grönroos mickel at csc.fi
Tue Mar 23 12:36:45 CET 2004


On Tue, 23 Mar 2004, Mickel Grönroos wrote:

> Anybody tried using Windows Media Player 9 via win32com?
> [...]
> Is "MediaPlayer.MediaPlayer.1" really the progid to use for Windows Media
> Player 9?

Hello again,

I got this far:

from win32com.client import Dispatch
wmp = Dispatch("WMPlayer.OCX")
wmp.openPlayer("C:\\Path\\To\\Media\\File")

This opens Windows Media Player 9 on my Win2000 box and starts playing the
media file. However, I would like to be able to control the media player
as well, and it is not fully self-evident how one does that.

I tried:

control = wmp.controls

This gives me a IWMPControls object that has methods for playing, pausing,
stopping etc. However, nothing happens when executing those methods, i.e.
the following simply returns None:

control.play()

Any ideas?

/Mickel G.

--
Mickel Grönroos, application specialist, linguistics, Research support, CSC
PL 405 (Tekniikantie 15 a D), 02101 Espoo, Finland, phone +358-9-4572237
CSC is the Finnish IT center for science, www.csc.fi




More information about the Python-list mailing list