Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to use CAtlComModule to implement a COM event sink?
    primarykey
    data
    text
    <p>I try to refactor an existing and <strong>working</strong> COM event sink implementation. The event sink class is written in C++ and resides in a DLL that uses the deprecated <a href="http://msdn.microsoft.com/en-us/library/1300df24.aspx" rel="nofollow"><code>CComModule</code></a> class. The goal of the refactoring is to replace <code>CComModule</code> by the new ATL 7.0 class <a href="http://msdn.microsoft.com/en-us/library/4h4fdwzf.aspx" rel="nofollow">CAtlComModule</a>.</p> <p>The existing implementation declares a global variable somewhere in a .cpp file:</p> <pre><code>CComModule _Module; </code></pre> <p>As you can see the variable has the usual "magic" name <code>_Module</code>. The customary initialization is missing, though, nowhere is there a call to <code>CComModule::Init()</code> and there is also no COM object map in the DLL project. The event sink still works, its event handler methods get properly called.</p> <p>Lacking any documentation how to transition from <code>CComModule</code> to <code>CAtlComModule</code>, I naively attempted to change the variable declaration to this:</p> <pre><code>CAtlComModule _Module; </code></pre> <p>It didn't work out, though: After the change the event sink stopped working, i.e. its event handler methods no longer get called.</p> <p>Does anyone know the steps one is supposed to perform to migrate to <code>CAtlComModule</code>? So far I have been unable to dig up a solution either on MSDN or via Google, but maybe I did not look properly...</p> <p>BTW: If necessary I can provide more details about the event sink implementation, but so far I felt that the problem is not in this area.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload