title: #import lead to a HRESULT 0x80040154 "Not registered class"
body: <p>I'm trying to use a COM DLL from VC++ 2005. I created a TestCOMlib.dll with ATL, created a simple interface ISimple and added one property (type LONG, name Property01) and one method (name Method01).</p>
  
  <p>The DLL seems to be correctly registered in the system (I use OleView to check the entries).</p>
  
  <p>I created a simple MFC dialog app to use the COM dll. I'm using the #import directive to incorporate information from the type library. Visual studio created for me the tlh and tli file.</p>
  
  <p>Then I tried to obtain the ISimple interface but I'm obtaining the error 0x80040154.
  The code I'm running inside the test application is the following:</p>
  
  <pre><code>HRESULT hr = S_OK;
  hr = CoInitialize(NULL);
  
  ISimplePtr myRef(__uuidof(ISimple));
  
  // Test prop and method
  myRef-&gt;Property01 = 5;
  LONG test = myRef-&gt;Property01;
  LONG ret = myRef-&gt;Method01(_T("Test input"));
  ret = myRef-&gt;Method01(NULL);
  
  myRef = NULL;
  CoUninitialize();
  </code></pre>
  
  <p>The row returning the error 0x80040154 is <strong>ISimplePtr myRef(__uuidof(ISimple))</strong>.
  OleView correctly display the interface and in the registry the entries seems to be good.</p>
  
  <p>What am I doing wrong? Any idea?</p>
  
  <p>Regards</p>