{"id":1959,"date":"2011-12-20T02:20:44","date_gmt":"2011-12-20T10:20:44","guid":{"rendered":"http:\/\/www.curlybrace.com\/words\/?p=1959"},"modified":"2011-12-20T02:21:03","modified_gmt":"2011-12-20T10:21:03","slug":"what-exactly-are-atls-begin_com_map-end_com_map-and-com_interface_entry","status":"publish","type":"post","link":"https:\/\/www.curlybrace.com\/words\/2011\/12\/what-exactly-are-atls-begin_com_map-end_com_map-and-com_interface_entry\/","title":{"rendered":"What Exactly Are ATL&#8217;s BEGIN_COM_MAP, END_COM_MAP, and COM_INTERFACE_ENTRY Macros?"},"content":{"rendered":"<p>There are many places where ATL&#8217;s COM_MAP macros are documented, but I haven&#8217;t seen it plainly stated what they actually mean.<\/p>\n<p>Simply put, BEGIN_COM_MAP implements _InternalQueryInterface.  COM_INTERFACE_ENTRY indicates that your class supports the specified interface.  END_COM_MAP finishes the _InternalQueryInterface implementation.<\/p>\n<blockquote><p>Note:  A QueryInterface implementation which calls this _InternalQueryInterface method must either be hand-coded, <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/c43h4867(v=VS.100).aspx\">or supplied by CComObject, CComAggObject, etc<\/a>.<\/p><\/blockquote>\n<p>For example:<\/p>\n<blockquote>\n<pre>\r\nclass MyClass :\r\n    public CComObjectRoot,\r\n    public ISomeInterface\r\n{\r\npublic:\r\n    BEGIN_COM_MAP(MyClass)\r\n        COM_INTERFACE_ENTRY(ISomeInterface)\r\n    END_COM_MAP()\r\n};\r\n\r\nCComClass<MyClass> myInstance = new CComClass<MyCLass>;\r\n<\/pre>\n<\/blockquote>\n<p>The COM_INTERFACE_ENTRY line indicates that MyClass implements ISomeInterface.  If QueryInterface is called to requests an ISomeInterface pointer, the call will succeed.  Without the COM_INTERFACE_ENTRY line, the QueryInterface call would fail.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There are many places where ATL&#8217;s COM_MAP macros are documented, but I haven&#8217;t seen it plainly stated what they actually mean. Simply put, BEGIN_COM_MAP implements _InternalQueryInterface. COM_INTERFACE_ENTRY indicates that your class supports the specified interface. END_COM_MAP finishes the _InternalQueryInterface implementation. &hellip; <a href=\"https:\/\/www.curlybrace.com\/words\/2011\/12\/what-exactly-are-atls-begin_com_map-end_com_map-and-com_interface_entry\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[261,198,15,283],"tags":[],"class_list":["post-1959","post","type-post","status-publish","format-standard","hentry","category-cplusplus","category-com","category-technology","category-windows-technology"],"_links":{"self":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/1959","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/comments?post=1959"}],"version-history":[{"count":13,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/1959\/revisions"}],"predecessor-version":[{"id":1972,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/1959\/revisions\/1972"}],"wp:attachment":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/media?parent=1959"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/categories?post=1959"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/tags?post=1959"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}