PDA

View Full Version : WMP ActiveX



tamad
22nd October 2007, 01:37
i have an application where i need to use the windows media player 11 as activeX control, and to access it programatically. I would like to start/pause/stop it over own buttons for instance.
I created the QAxWidget object using the setControl() method and the WMP 11 CLS_ID. Then I used QueryInterface() to get a pointer to the IWMPControls interface. The returned pointer is not null, but any call to an interface method (for instance i try to call the method isAvailable("play") from IWMPControls) leads to a crash. I generated the cpp and h files for the WMP interface using the dumpcpp tool.
Can anyone help please ?
Thanks in advance.

wysota
22nd October 2007, 07:22
Can we see the code? What happens if you use dynamicCall() instead?

tamad
22nd October 2007, 09:30
Can we see the code? What happens if you use dynamicCall() instead?

I dont think I can use dynamicCall(), as the controls() method of WMPlayer interface returns a pointer to IWMPControls. Or is there any possibility to cast a QVariant object to a IWMPControls pointer ?

mchara
22nd October 2007, 15:29
Did You tried to use querySubObject()?

it returns QAxObject instead of raw interface, so You should be able to use dynamicCall() to use methods encapsulated in subobjects.

tamad
22nd October 2007, 22:01
Did You tried to use querySubObject()?

it returns QAxObject instead of raw interface, so You should be able to use dynamicCall() to use methods encapsulated in subobjects.

You are right, querySubObject() did the job !
Thank you for the good hint.