I'm using Visual Studio 2017. I've made an MFC project and added ATL support (VS did that for me). The software I'm developing requires the implementation of two custom interfaces and a category ID to be added to the registry under "Implemented Categories".
I have tried editing the .rgs file like below, but that did not work.
HKCR{
NoRemove CLSID{
ForceRemove {97ffeebf-bc8a-4faf-8672-0041459fbf52} = s 'ATLSimpleObject class'{
LocalServer32 = s '%MODULE%'{
val ServerExecutable = s '%MODULE_RAW%'
}
TypeLib = s '{1242F892-AA3F-4C37-A82D-4D0AB9DA6A2E}'
Version = s '1.0'
'Implemented Categories' {
'{94A4D4AB-BC52-494e-9020-95C1CE4318B5}' {
}
}
}
}
}
I'm now trying using the BEGIN_CATEGORY_MAP macro, but the ID still does not get added to the registry.
using namespace ATL;
// CATLSimpleObject
class ATL_NO_VTABLE CATLSimpleObject :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CATLSimpleObject, &CLSID_ATLSimpleObject>,
public IATLSimpleObject,
public Interface1,
public Interface2
{
public:
CATLSimpleObject(){ }
DECLARE_REGISTRY_RESOURCEID(311)
DECLARE_NOT_AGGREGATABLE(CATLSimpleObject)
BEGIN_COM_MAP(CATLSimpleObject)
COM_INTERFACE_ENTRY(IATLSimpleObject)
COM_INTERFACE_ENTRY(Interface1)
COM_INTERFACE_ENTRY(Interface2)
END_COM_MAP()
BEGIN_CATEGORY_MAP(CATLSimpleObject)
IMPLEMENTED_CATEGORY(CATID_CategoryToBeImplemented)
END_CATEGORY_MAP()
//Methods emitted
}
Where and how should I do it?
EDIT: Context (from a previous question of mine):
I'm working with some old robotics software which is able to get information from a COM object if it implements some predefined interfaces. Since this old software runs on Windows 2000, I want to use DCOM to (try to) avoid having to compile something for Windows 2000. (I am aware that the program that has to be called probably needs to work, or at least exist, on the Windows 2000 computer as well)
The other computer will be called through DCOM and will process an image using a configured set of steps. I would like a GUI to show the incoming and outgoing images and the ability to change the steps it undertakes.
Addition to context from previous question
The application needs to be an EXE COM server, the application I'm making it for does not accept dll's, unfortunately. I'm using MFC for the GUI components, because I thought that would be the easiest way. I have configured VS to "Use MFC in a shared DLL".
I've switched from .NET to C++, because out-of-proc COM in .NET is "quite complicated and brittle and not directly supported" -Hans Passant. And I have to agree so far: I managed to do more in C++ in 1 day, then with .NET in a week.