com - IServiceProvider::QueryService returned E_INVALIDARG in mfc -
i working on small application. want embed activex control , want remote in mfc application. need iserviceprovider
interface of com. iserviceprovider
gives access of iwmpremotemediaaccess
interface. using this:
but returnes e_invalidarg
every time. can tell me problem.
ioleobject* oleobject; ccomptr<iserviceprovider> m_spprovider; ccomptr<iwmpremotemediaservices> m_spservices; hresult hr = cocreateinstance(__uuidof(windowsmediaplayer), 0, clsctx_inproc_server, iid_ioleobject, (void**)&oleobject); hr = oleobject->queryinterface(__uuidof(iserviceprovider), (void**)&m_spprovider); if(succeeded(hr)) { //here return e_invalidarg (hr = e_invalid_arg) hr = m_spprovider->queryservice(__uuidof(iwmpremotemediaservices), iid_iserviceprovider, (void**)&m_spservices); }
i not able understand argument wrong. more sure first argument. can tell me be.
thank
iwmpremotemediaservices
interface supposed implement on side, not query via queryservice
. msdn:
enabling remote embedding
to enable remote embedding of windows media player control, your program must implement iserviceprovider , iwmpremotemediaservices interfaces. iserviceprovider standard component object model (com) interface single method called queryservice. windows media player calls method retrieve pointer iwmpremotemediaservices interface.
then wmp call methods of interface, methods implement. code showing attempt obtain wmp's iserviceprovider
, services control implements. vice versa, wmp - discover services implement.
see remotehost.h , remotehost.cpp here on how classes should like.
Comments
Post a Comment