我正嘗試在Visual Studio 2008中使用CTI Toolkit 4.03構建CTI連接器解決方案。我得到一個錯誤無法在創建CTI適配器時實例化抽象類
Error 1 error C2259: 'ATL::CComObject<Base>' : cannot instantiate abstract class c:\program files (x86)\microsoft visual studio 9.0\vc\atlmfc\include\atlcom.h 1801 while compiling
我的代碼是
#include "stdafx.h"
#include "MyAdapterBase.h"
STDMETHODIMP CMyAdapterBase::GetAdapterName(BSTR* bsName)
{
bsName = SysAllocString(L"My Sample CTI Adapter");
return S_OK;
}
STDMETHODIMP CMyAdapterBase::GetAdapterVersion(BSTR bsName)
{
bsName = SysAllocString(L"1.0 Candidate 2");
return S_OK;
}
STDMETHODIMP CMyAdapterBase::UIAction(BSTR message){
{
return S_OK;
}
void CMyAdapterBase::SendUIRefreshEvent(_bstr_t xml)
{
CCTILogger::Log(LOGLEVEL_HIGH,"Sending XML (len %d): %s",xml.length(),
(wchar_t)xml);
_ISalesforceCTIAdapterEvents_UIRefresh(xml);
}
你應該向我們展示有問題的代碼......你提供的信息越多,你會得到。 – LihO
問題是因爲你的COM接口中有一些方法沒有在你的COM類中實現。你最好發佈接口定義和COM類定義。 – sharptooth
發佈的代碼片段是無關緊要的。發佈完整的錯誤日誌,並注意它應該更精確地將您的源代碼問題位置進一步放在您刪除的片段上。我的猜測是你正在嘗試使用COM類的靜態或堆棧分配實例,而你應該使用'CComObject <...> :: CreateInstace'創建 –