C++ 到ATL的静态链接总是失败
我使用一些ATL函数来创建媒体控件,但似乎只能使用动态链接到ATL选项。当我切换到ATL的静态链接时,我就是无法成功创建控件 我很困惑。有人能帮我吗 这是我的密码:C++ 到ATL的静态链接总是失败,c++,visual-studio-2010,com,mfc,atl,C++,Visual Studio 2010,Com,Mfc,Atl,我使用一些ATL函数来创建媒体控件,但似乎只能使用动态链接到ATL选项。当我切换到ATL的静态链接时,我就是无法成功创建控件 我很困惑。有人能帮我吗 这是我的密码: //related headers #include <wmp.h> #include <atlbase.h> #include <atlcom.h> #include <atlhost.h> #include <atlctl.h> //related vars CAxW
//related headers
#include <wmp.h>
#include <atlbase.h>
#include <atlcom.h>
#include <atlhost.h>
#include <atlctl.h>
//related vars
CAxWindow m_wndView; // ActiveX host window class. CComPtr<IWMPPlayer>
m_spWMPPlayer; // Smart pointer to IWMPPlayer interface.
//related function code:
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);
/*
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;
当静态链接到ATL时,必须使用预处理器:\u ATL\u DLL
您可以在此处设置:属性页| C/C++|预处理器S|U FAIL==hr//失败标志着没有失败这回事。可能是你失败了。