Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RE: Pythoncom scripting Windows Media Player & visible

Reply
Thread Tools

RE: Pythoncom scripting Windows Media Player & visible

 
 
Stefan Schukat
Guest
Posts: n/a
 
      08-03-2005
Hello,

you have to put the ocx in a container window (e.g. a dialog or the IE).
Without this the media player just acts like a normal COM object.

Example for the dialog you can find in
[Pythonroot]\Lib\site-packages\pythonwin\pywin\Demos\ocx

Bye

Stefan

> -----Original Message-----
> From: python-list-bounces+sschukat=(E-Mail Removed)
> [mailtoython-list-bounces+sschukat=(E-Mail Removed)] On
> Behalf Of Bill Eldridge
> Sent: Tuesday, August 02, 2005 6:15 PM
> To: http://www.velocityreviews.com/forums/(E-Mail Removed)
> Subject: Pythoncom scripting Windows Media Player & visible
>
>
> I'm trying to make Windows Media Player visible and control
> it from Python. It seems when I call it below, I get only the
> console version, and there's no Visible method like with
> Internet Explorer.
> I do catch events, but I need it visible.
> Should it be put into a panel instead?
> Should a different type dispatch be called or a different
> method? it seems that there are a console and a windows
> classes in the COM browser, but I can't seem to access any
> useful windows classes.
> I get "fullScreen" as False, but can't set it.
> openPlayer(address) will launch a visible window, but with no
> control of the the window after that.
>
> Ideas?
>
> from win32com.client import Dispatch,DispatchWithEvents
>
> class WMPEvents:
> def OnVisible(self,evt):
> print "OnVisible changed:",evt
> def OnError(self,evt=None):
> print "OnError",evt
> def OnMediaError(self,evt=None):
> print "OnMediaError",evt
> def OnDisconnect(self,evt):
> print "OnDisconnect",evt
> def OnStatusChange(self):
> print "OnStatusChange"
> def OnDisconnect(self,evt):
> print "Disconnect",evt
> def OnBuffering(self,evt):
> print "OnBuffering changed:",evt
> def OnOpenStateChange(self,evt=None):
> print "OnOpenStateChange" ,evt
>
> mp = DispatchWithEvents("WMPlayer.OCX.7",WMPEvents)
> mp.Visible = True # Does nothing
> tune = mp.newMedia("C:/WINDOWS/system32/oobe/images/title.wma")
> mp.currentPlaylist.appendItem(tune)
> mp.controls.playItem(tune)
> mp.controls.play()
> raw_input("Press enter to stop playing")
> mp.controls.stop()
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>


The "Leading Manufacturing Test Company of the Year 2005"
http://www.dspace.de/goto?f_s_award
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows 7, Media Player - Settings for Media Serving NOT being savedfor Home Group Tim Wells Windows 64bit 0 10-27-2009 01:26 PM
Scripting Windows Media Player Dan Javascript 4 05-23-2006 05:09 PM
Windows Media Player - Download Media Info From Internet is Greyed Out Alan NZ Computing 3 02-27-2006 10:38 PM
Pythoncom scripting Windows Media Player & visible Bill Eldridge Python 0 08-02-2005 05:14 PM
mp3 player windows media player Bigfred Computer Support 1 10-28-2003 09:46 PM



Advertisments