Static link to ATL alwayas fail
-
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?
//related headers
#include
#include
#include
#include
#include//related vars
CAxWindow m_wndView; // ActiveX host window class. CComPtr
m_spWMPPlayer; // Smart pointer to IWMPPlayer interface.//related function code:
CComPtr spHost;
HRESULT hr;
m_wndView.Create(m_hWnd, rect, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
hr = m_wndView.QueryHost(&spHost);
/*
when I switch to "Static Link to ATL" option, I will fail here
E_FAIL == hr;//the failure flag
*/
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; -
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?
//related headers
#include
#include
#include
#include
#include//related vars
CAxWindow m_wndView; // ActiveX host window class. CComPtr
m_spWMPPlayer; // Smart pointer to IWMPPlayer interface.//related function code:
CComPtr spHost;
HRESULT hr;
m_wndView.Create(m_hWnd, rect, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, WS_EX_CLIENTEDGE);
hr = m_wndView.QueryHost(&spHost);
/*
when I switch to "Static Link to ATL" option, I will fail here
E_FAIL == hr;//the failure flag
*/
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;