cocreateinstance and windows media player
-
Hi, I am trying to create an istance of the windows media player control but it returns an error... here is my code:
HRESULT hret; IUnknown *pUnknown; MediaPlayer::IMediaPlayerPtr pMediaPlayer = NULL; IConnectionPoint *pConnectionPoint; IConnectionPointContainer *pConnectionPointContainer; IOleInPlaceObject *pInPlaceObject; IOleObject *pObject; DWORD dwAdviseCookie; hret = CoCreateInstance(__uuidof(MediaPlayer::IMediaPlayerPtr), NULL, CLSCTX_ALL, pMediaPlayer.GetIID(), (void**)(&pMediaPlayer));
Thank you very much for your answers in advance... Well... I am a beginner ... -
Hi, I am trying to create an istance of the windows media player control but it returns an error... here is my code:
HRESULT hret; IUnknown *pUnknown; MediaPlayer::IMediaPlayerPtr pMediaPlayer = NULL; IConnectionPoint *pConnectionPoint; IConnectionPointContainer *pConnectionPointContainer; IOleInPlaceObject *pInPlaceObject; IOleObject *pObject; DWORD dwAdviseCookie; hret = CoCreateInstance(__uuidof(MediaPlayer::IMediaPlayerPtr), NULL, CLSCTX_ALL, pMediaPlayer.GetIID(), (void**)(&pMediaPlayer));
Thank you very much for your answers in advance... Well... I am a beginner ... -
-
Hi, I am trying to create an istance of the windows media player control but it returns an error... here is my code:
HRESULT hret; IUnknown *pUnknown; MediaPlayer::IMediaPlayerPtr pMediaPlayer = NULL; IConnectionPoint *pConnectionPoint; IConnectionPointContainer *pConnectionPointContainer; IOleInPlaceObject *pInPlaceObject; IOleObject *pObject; DWORD dwAdviseCookie; hret = CoCreateInstance(__uuidof(MediaPlayer::IMediaPlayerPtr), NULL, CLSCTX_ALL, pMediaPlayer.GetIID(), (void**)(&pMediaPlayer));
Thank you very much for your answers in advance... Well... I am a beginner ...Without knowing the error (post the return value from
CoCreateInstance()
) I can only guess, but the first parameter looks like an IID, not a CLSID. You need to put the CLSID of the WMP object there. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain." -- Paul Watson, Linux Zombie -
Without knowing the error (post the return value from
CoCreateInstance()
) I can only guess, but the first parameter looks like an IID, not a CLSID. You need to put the CLSID of the WMP object there. --Mike-- Personal stuff:: Ericahist | Homepage Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ ---- "Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain." -- Paul Watson, Linux Zombie...ok I fixed the classid thing like this:
CLSID idMediaPlayer; HRESULT hr = ::CLSIDFromProgID (L"WMPlayer.OCX.1", &idMediaPlayer);
Well I was using windows media player 8 but I found that I jammed up the class-id... then I installed Windows Media Player 9... The error code is: "REGDB_E_CLASSNOTREG" ... I am not sure if I have to use "msdxm.ocx" for windows media player 9... Well... I am a beginner ... -
...ok I fixed the classid thing like this:
CLSID idMediaPlayer; HRESULT hr = ::CLSIDFromProgID (L"WMPlayer.OCX.1", &idMediaPlayer);
Well I was using windows media player 8 but I found that I jammed up the class-id... then I installed Windows Media Player 9... The error code is: "REGDB_E_CLASSNOTREG" ... I am not sure if I have to use "msdxm.ocx" for windows media player 9... Well... I am a beginner ...