|
-
January 12th, 2010, 10:48 PM
#1
ATL COM server visual studios
Hi,
Im new to programming and am attempting to implement an ATL COM server following a software development kit. However, I am having all sorts of problems. Iv created an ATL project and added a simple object called CoSensorServer. Iv then implemented interfaces:
IPMSensorServer,
IPMSensorConfig,
IPMPositionGenerator
and IPMSensorRuntime
from a library included in the SDK.
My CoSensorServer cpp file looks like this:
/ CoSensorServer.cpp : Implementation of CCoSensorServer
#include "stdafx.h"
#include "CoSensorServer.h"
// CCoSensorServer
class ATL_NO_VTABLE CCoSensorServer :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CCoSensorServer, &CLSID_CoSensorServer>,
public ICoSensorServer,
public IPMPositionGenerator,
public IPMSensorConfig,
public IPMSensorRuntime,
public IPMSensorServer
{
public:
CCoSensorServer()
{
}
DECLARE_REGISTRY_RESOURCEID(IDR_COSENSORSERVER)
DECLARE_NOT_AGGREGATABLE(CCoSensorServer)
BEGIN_COM_MAP(CCoSensorServer)
COM_INTERFACE_ENTRY(ICoSensorServer)
COM_INTERFACE_ENTRY(IPMPositionGenerator)
COM_INTERFACE_ENTRY(IPMSensorConfig)
COM_INTERFACE_ENTRY(IPMSensorRuntime)
COM_INTERFACE_ENTRY(IPMSensorServer)
END_COM_MAP()
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
// IPMPositionGenerator Methods
public:
STDMETHOD(CreatePosGen)(GUID PosGenId, GUID SensorId, long * plType)
{
return E_NOTIMPL;
}
STDMETHOD(ConfigurePosGen)(GUID PosGenId, GUID SensorId, signed char * pbChanged)
{
return E_NOTIMPL;
}
STDMETHOD(RemovePosGen)(GUID PosGenId)
{
return E_NOTIMPL;
}
STDMETHOD(LoadPosGen)(GUID PosGenId, long lType, long lSize, unsigned char * pucBuffer, signed char * pbUpgraded)
{
return E_NOTIMPL;
}
STDMETHOD(SavePosGen)(GUID PosGenId, long * plSize, unsigned char * * ppucBuffer)
{
return E_NOTIMPL;
}
// IPMSensorConfig Methods
public:
STDMETHOD(InitServer)()
{
return E_NOTIMPL;
}
STDMETHOD(CreateSensor)(GUID SensorId)
{
return E_NOTIMPL;
}
STDMETHOD(ConfigureSensor)(GUID SensorId, signed char * pbChanged)
{
return E_NOTIMPL;
}
STDMETHOD(RemoveSensor)(GUID SensorId)
{
return E_NOTIMPL;
}
STDMETHOD(LoadSensor)(GUID SensorId, long lSize, unsigned char * pucBuffer, signed char * pbUpgraded)
{
return E_NOTIMPL;
}
STDMETHOD(SaveSensor)(GUID SensorId, long * plSize, unsigned char * * ppucBuffer)
{
return E_NOTIMPL;
}
STDMETHOD(ShowStatus)(GUID SensorId)
{
return E_NOTIMPL;
}
// IPMSensorRuntime Methods
public:
STDMETHOD(StartSensor)(GUID SensorId, long lGenerators, GUID * pPosGenerators, _IPMSensorResult * p_IPMSensorResult)
{
return E_NOTIMPL;
}
STDMETHOD(StopSensor)(GUID SensorId)
{
return E_NOTIMPL;
}
STDMETHOD(ShowRuntimeInfo)(GUID SensorId, signed char bShow)
{
return E_NOTIMPL;
}
// IPMSensorServer Methods
public:
STDMETHOD(GetName)(BSTR * bstrName)
{
return E_NOTIMPL;
}
STDMETHOD(GetDescription)(BSTR * bstrDescription)
{
return E_NOTIMPL;
}
STDMETHOD(GetVersion)(long * plMajor, long * plMinor)
{
return E_NOTIMPL;
}
};
OBJECT_ENTRY_AUTO(__uuidof(CoSensorServer), CCoSensorServer)
I am getting the following error when compiling:
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlcom.h(1760): error C2259: 'ATL::CComObject<Base>' : cannot instantiate abstract class
with [ Base=CCoSensorServer ]
The output:
Rebuild All started: Project: MySensorServer, Configuration: Debug Win32 ------
Deleting intermediate files and output files for project 'MySensorServer', configuration 'Debug|Win32'.
Creating Type Library...
Processing .\MySensorServer.idl
MySensorServer.idl
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\oaidl.idl
oaidl.idl
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\objidl.idl
objidl.idl
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\unknwn.idl
unknwn.idl
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\wtypes.idl
wtypes.idl
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\basetsd.h
basetsd.h
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\guiddef.h
guiddef.h
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\ocidl.idl
ocidl.idl
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\oleidl.idl
oleidl.idl
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\servprov.idl
servprov.idl
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\urlmon.idl
urlmon.idl
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\msxml.idl
msxml.idl
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\oaidl.acf
oaidl.acf
Processing C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\include\ocidl.acf
ocidl.acf
Compiling...
stdafx.cpp
Compiling...
CoSensorServer.cpp
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlcom.h(1760) : error C2259: 'ATL::CComObject<Base>' : cannot instantiate abstract class
with
[
Base=CCoSensorServer
]
due to following members:
'HRESULT IPMPositionGenerator::ConfigurePosGen(GUID,GUID,char *)' : pure virtual function was not defined
c:\Documents and Settings\Andre Bedon\My Documents\Visual Studio Projects\MySensorServer\Debug\externalsensor.tlh(102) : see declaration of 'IPMPositionGenerator::ConfigurePosGen'
'HRESULT IPMPositionGenerator::LoadPosGen(GUID,long,long,unsigned char *,char *)' : pure virtual function was not defined
c:\Documents and Settings\Andre Bedon\My Documents\Visual Studio Projects\MySensorServer\Debug\externalsensor.tlh(108) : see declaration of 'IPMPositionGenerator::LoadPosGen'
'HRESULT IPMSensorConfig::ConfigureSensor(GUID,char *)' : pure virtual function was not defined
c:\Documents and Settings\Andre Bedon\My Documents\Visual Studio Projects\MySensorServer\Debug\externalsensor.tlh(73) : see declaration of 'IPMSensorConfig::ConfigureSensor'
'HRESULT IPMSensorConfig::LoadSensor(GUID,long,unsigned char *,char *)' : pure virtual function was not defined
c:\Documents and Settings\Andre Bedon\My Documents\Visual Studio Projects\MySensorServer\Debug\externalsensor.tlh(78) : see declaration of 'IPMSensorConfig::LoadSensor'
'HRESULT IPMSensorRuntime::ShowRuntimeInfo(GUID,char)' : pure virtual function was not defined
c:\Documents and Settings\Andre Bedon\My Documents\Visual Studio Projects\MySensorServer\Debug\externalsensor.tlh(184) : see declaration of 'IPMSensorRuntime::ShowRuntimeInfo'
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlcom.h(1752) : while compiling class-template member function 'HRESULT ATL::CComCreator<T1>::CreateInstance(void *,const IID &,LPVOID * )'
with
[
T1=ATL::CComObject<CCoSensorServer>
]
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlcom.h(1832) : see reference to class template instantiation 'ATL::CComCreator<T1>' being compiled
with
[
T1=ATL::CComObject<CCoSensorServer>
]
c:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlcom.h(1828) : while compiling class-template member function 'HRESULT ATL::CComCreator2<T1,T2>::CreateInstance(void *,const IID &,LPVOID * )'
with
[
T1=ATL::CComCreator<ATL::CComObject<CCoSensorServer>>,
T2=ATL::CComFailCreator<-2147221232>
]
c:\Documents and Settings\Andre Bedon\My Documents\Visual Studio Projects\MySensorServer\CoSensorServer.cpp(135) : see reference to class template instantiation 'ATL::CComCreator2<T1,T2>' being compiled
with
[
T1=ATL::CComCreator<ATL::CComObject<CCoSensorServer>>,
T2=ATL::CComFailCreator<-2147221232>
]
MySensorServer.cpp
Generating Code...
Build log was saved at "file://c:\Documents and Settings\Andre Bedon\My Documents\Visual Studio Projects\MySensorServer\Debug\BuildLog.htm"
MySensorServer - 1 error(s), 0 warning(s)
------ Skipped Rebuild All: Project: MySensorServerPS, Configuration: Debug Win32 ------
Project configuration skipped because it is not selected in this solution configuration
---------------------- Done ----------------------
Rebuild All: 0 succeeded, 1 failed, 1 skipped
Any ideas how I can overcome this error? Iv spent too many hours to no avail. Thanks very much in advance.
Andre
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|