title: Examples of creating a simple COM component using C++ in Visual Studio 2008
body: <p>Does anyone know of any recent examples of how to create a simple COM component in C++ using Visual Studio 2008 so I can learn how to marshal different kinds of data between unmanaged and managed code, and back again. I've found a few tutorials that suggest a C++ ATL project, but project settings page no longer has the settings mentioned in the article.</p>
  
  <p>What I want to do is implement a C++ DLL that would be used from C# like this:</p>
  
  <pre><code>MyComComponent myComp = new MyComComponent();
  myComp.Register(new ClassWithCallbacks()) /* implements IMyCallback */
  </code></pre>
  
  <p>The COM component would, at timed intervals, call various methods on the provided IMyCallback instance to obtain information. Similarly, the C# code might call various methods directly, when needed.</p>
  
  <p>This mechanism is to enable an application to be monitored either by (the C++ side) polling the C# side, or by the C# side reporting back to the C++ side.</p>