title: COM Error: Class not registered (I'm sure it is)
body: <p>I have a large complex program that has a COM problem.<br>
  I'm attempting to write a much smaller <a href="http://sscce.org/" rel="nofollow">SSCCE</a> program to reduce the problem.</p>
  
  <p>However, no matter what I try, the <code>CoCreateInstance</code> in my SSCCE keeps coming back with </p>
  
  <pre><code>hr 0x80040154 (Class Not Registered)  (For CoCreateInstance)
  0x800706B5: The interface is unknown. (for ICalendarPtr constructor)
  </code></pre>
  
  <p><strike>I'm using the same GUIDs and other parameters from the bigger program.</strike><br>
  <em>(turns out I wasn't using the same guids.  Just similar ones)</em>
  <br></p>
  
  <p>I'm linking to the same libraries, and have the same DLLs available (both locally and properly registered in Program Files).</p>
  
  <p>I'm not a Registry expert, but looking through the registry, I do find the Interface and Class GUID look to be properly registered, with a TypeLib-key that refers to a DLL that is present and accessible.</p>
  
  <p>Can you think of something I might be missing that would cause one program to create a COM object successfully, but another to say the class isn't registered?</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>_COM_SMARTPTR_TYPEDEF(ICalendar, __uuidof(ICalendar));
  
  int _tmain(int argc, _TCHAR* argv[])
  {
      CoInitialize(NULL);
  
      CLSID classID = __uuidof(ICalendar);
      REFIID iid = __uuidof(IUnknown);
      LPVOID pRet;
      HRESULT hr = CoCreateInstance(classID, NULL, CLSCTX_INPROC_SERVER, iid, &amp;pRet);
      // Result: 0x80040154 Class not registered
  
      GUID guid = __uuidof(ICalendar);
      ICalendarPtr pDtTm(guid);
      // Result: First-chance exception at 0x773dc41f in COMTest.exe: 0x800706B5: The interface is unknown.
  
  
      return 0;
  }
  </code></pre>