|
I use some ATL functions to create a Media control. But, it seems that I can only use Dynamic link to ATL option, when I switch to Static link to ATL. I just can't create the control successfully.
I'm so confused. Anyone can help me?
#include <wmp.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlhost.h>
#include <atlctl.h>
CAxWindow m_wndView; m_spWMPPlayer;
CComPtr<IAxWinHostWindow> spHost;
HRESULT hr;
m_wndView.Create(m_hWnd, rect, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
hr = m_wndView.QueryHost(&spHost);
if(!SUCCEEDED(hr)) return FALSE;
hr = spHost->CreateControl(CComBSTR(_T("{6BF52A52-394A-11d3-B153-00C04F79FAA6}")), m_wndView, 0);
if(!SUCCEEDED(hr)) return FALSE;
hr = m_wndView.QueryControl(&m_spWMPPlayer);
if(!SUCCEEDED(hr)) return FALSE;
|
|
|
|
|
You need to look at the actual error code value when you get a FAIL result, in order to see why it has failed.
One of these days I'm going to think of a really clever signature.
|
|
|
|