最近在学WTL,资料比较少了(特别是实践性的)发现了两个小问题,特此记录。
Q:Error is:"!InlineIsEqualGUID(*m_plibid, GUID_NULL) && "Did you forget to pass the LIBID to CComModule::Init?"
A:This can be solved one of two ways:
1) Change your "Use of ATL" setting to "Dynamic Link to ATL" in your project properties.
2) Change your "Use of ATL" setting to "Static Link to ATL" and instead of using
hRes = _Module.Init(NULL, hInstance);
line in your _tWinMain, use this instead:
GUID guid;
hRes = _Module.Init(NULL, hInstance, &guid);
Q:在WTL中添加ATL simply object时,提示“ATL classes can only be added to MFC EXE and MFC Regular DLL projects or projects with full ATL support.”
A:找到C:/Program Files/Microsoft Visual Studio 8/VC/VCWizards/1033/common.js 文件
1. locate the function IsATLProject
2. change the line:
if (strTypeString == "ATL::CComModule" || strTypeString == "ATL::CAutoThreadModule")
to:
if (strTypeString == "ATL::CComModule" || strTypeString == "ATL::CAutoThreadModule" || strTypeString =="WTL::CServerAppModule" || strTypeString == "WTL::CAppModule")
3. save your changes