MFC Com DLL Example

I understand how to create a ATL Project + ATL Simple Object to add COM components to Visual Studios 2015 project, but I don't understand at all how to create a MFC COM Project. If someone can create an example MFC COM project for me I would highly appreciate it.
First do you have any reason to use old Visual Studio?

Creating MFC project is simple, use the "Windows Desktop Wizard" in VS in "create new project" dialog window.

then once MFC project is created you simply make use of COM interfaces.

But I assume you never used COM interfaces? because there is no such thing as
"add COM components to VS project"

I'm not MFC user, but acording to msdn COM support in MFC is very limited:
https://docs.microsoft.com/en-us/cpp/mfc/mfc-com?view=vs-2019

If you want to learn COM it's better to do it with pure Win32 API's You can start learning about COM here:
https://docs.microsoft.com/en-us/windows/win32/com/component-object-model--com--portal
Last edited on
@mailibor

Visual Studios 2015 is being used because in 2017 there are issues when using the class wizards for MFC and ATL and in 2019 they don't have an MFC option, so 2015 is the more stable one.

I have created an MFC Dialog before, I have created COM interfaces using ATL, at least through the wizards.

When I mean by adding COM components to VS project, when you use the class wizard to add a ATL Simple Object class, when you are defining the class name, it will also define the COM class names and within their appropriate .h file, there are the macros and definitions such as COM_INTERFACE_ENTRY which I assume for MFC is BEGIN_DISPATCH_MAP. Pretty much using ATL Project + ATL Simple Object Class creates the skeleton code for COM programming using ATL. I want that for MFC but I have researched a lot and I don't know how to achieve it, but I guess my last resort is to use Win32 API. Only problem is, I have an MFC dialog I need to make a COM object out of and I don't know how to do that with MFC.
@Furry Guy

I have already viewed this tutorial along with many tutorials online. The issue with this one is, that it does not deal with IDL Interfaces and that is important for COM Objects.
Registered users can post here. Sign in or register to post.