Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 458975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:43:35+00:00 2026-05-12T22:43:35+00:00

ATL END_COM_MAP macro is defined as follows: #define END_COM_MAP() \ __if_exists(_GetAttrEntries) {{NULL, (DWORD_PTR)_GetAttrEntries, _ChainAttr

  • 0

ATL END_COM_MAP macro is defined as follows:

#define END_COM_MAP() \
    __if_exists(_GetAttrEntries) {{NULL, (DWORD_PTR)_GetAttrEntries, _ChainAttr }, }\
    {NULL, 0, 0}}; return _entries;} \
    virtual ULONG STDMETHODCALLTYPE AddRef( void) throw() = 0; \
    virtual ULONG STDMETHODCALLTYPE Release( void) throw() = 0; \
    STDMETHOD(QueryInterface)(REFIID, void**) throw() = 0;

It is intended to be used within definition of classes inherited from COM interfaces, for example:

class ATL_NO_VTABLE CMyClass :
    public CComCoClass<CMyClass, &MyClassGuid>,
    public CComObjectRoot,
    public IMyComInterface
{
public:
    BEGIN_COM_MAP( CMyClass )
        COM_INTERFACE_ENTRY( IMyComInterface)
    END_COM_MAP()
};

This means that QueryInterface(), AddRef() and Release() are declared as pure virtual in this class. Since I don’t define their implementation this class should be uncreatable. Yet ATL successfully instantiates it.

How does it work and why are those IUnknown member functions redeclared here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T22:43:36+00:00Added an answer on May 12, 2026 at 10:43 pm

    It’s been a while since I used ATL but, IIRC, what ends up being instantiated is not CMyClass, but CComObject<CMyClass>.

    CComObject implements IUnknown and inherits from its template parameter.

    Edit: The “Fundamentals of ATL COM Objects” page on MSDN nicely illustrates what’s going on.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Modern ATL/MFC applications now have access to a new shared pointer class called CAutoPtr,
Without: ATL MFC Note: Client is executing in a different thread to that of
I have an ATL control that I want to be Unicode-aware. I added a
Without : MFC ATL using COM , with pure C++ , steps taken thus
Without: MFC ATL Using pure C++, WSAGetLastError() returns 10014 - Bad address What I'm
Without the following: ATL MFC Question: How to get the COM Server , to
I use VS6 and ATL with CServiceModule to implement a custom windows service. In
I am creating an ATL 8.0 based ActiveX control in C++ using Visual Studio
Note : No MFC No ATL Using Visual C++ While attempting a connection between
I was a C++ developer (mostly ATL/COM stuff) until, as many of us, I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.