Skip to content Skip to sidebar Skip to footer

Windows Media Player Com Automation Works From Vbs But Not From Python

I try to use Windows Media Player to play audio files via COM. The following code works fine in VBS: Set wmp = CreateObject('WMPlayer.OCX') wmp.settings.autoStart = True wmp.settin

Solution 1:

It seems the problem is that time.sleep doesn't pump window messages. Use some other timeout function that pumps window messages.

The reason is that Windows Media Player is an STA components, most probably because it's most commonly used as a graphical component. Some of its internals depend on regular message pumping, most probably a high-precision multimedia timer thread that sends window messages for communication, or it might depend on actual WM_TIMER messages.

Post a Comment for "Windows Media Player Com Automation Works From Vbs But Not From Python"