COM objects in threads

Markus von Ehr vonehr at ira.uka.de
Mon Feb 5 05:33:26 EST 2001


Hallo,

I still didn't find out the solution of accessing a COM object from
a thread.
I play a mp3 File with MediaPlayer using COM like this:
(Globals. are my global variables)

  Globals.ie =
win32com.client.dynamic.Dispatch("InternetExplorer.Application")
  Globals.ie.Navigate(r'about:blank')
  Globals.doc = Globals.ie.Document
  Globals.doc.body.insertAdjacentHTML("afterBegin",
  """
  <OBJECT ID="MediaPlayer1"
  CLASSID="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95">
  </OBJECT>
  """)
    
  Globals.mp = Globals.doc.body.children("MediaPlayer1").object

  Globals.mp.FileName = "MySoundFile.mp3"

In another thread I want to set the New SoundFile:

  Globals.mp.FileName = "null.wav"

but I have a Pythoncommerror.

Anybody can help me accessing the mp object in the thread? How
can I set the new FileName?

Thanks for any comments,

Markus



More information about the Python-list mailing list