title: How to migrate a program with Common Controls from Visual C++ 6.0 to Visual C++ 2010 (on 64-bit machine)
body: <p>I am attempting to migrate a Visual C++ 6.0 program (originally written on a Windows NT machine) to Visual C++ 2010 for use on my 64-bit Windows 7 PC. The program compiles fine but there is a runtime assertion failure which yeilds the following output in the debugger:</p>
  
  <blockquote>
    <p>CoCreateInstance of OLE control {F9043C85-F6F2-101A-A3C9-08002B2F49FB}
    failed.</p>
    
    <p>Result code: 0x80040154</p>
    
    <p>Is the control is properly registered?</p>
    
    <p>Warning: Resource items and Win32 Z-order lists are out of sync. Tab
    order may be not defined well. </p>
    
    <p>Warning: CreateDlgControls failed during dialog init.</p>
  </blockquote>
  
  <p>The failed assertion is on line 925 of occcont.cpp:</p>
  
  <pre><code>ASSERT(IsWindow(pTemp-&gt;m_hWnd));
  </code></pre>
  
  <p>I understand from <a href="http://dynamicsuser.net/forums/p/25968/140697.aspx" rel="nofollow">http://dynamicsuser.net/forums/p/25968/140697.aspx</a> that the Microsoft Common Dialog Control v6.0 might not be registered. I registered it with Regsrv32.exe and restarted windows but the error persists.</p>
  
  <p>My goal is to tell whether this old program can work with new tools--not to actually rewrite the old program (though that will come later). Is it possible to make the old program run on my newer machine?</p>
  
  <p><strong>EDIT: Addition of the code which causes the assertion failure</strong></p>
  
  <pre><code>BOOL CCameraSimulationApp::InitInstance()
  {
      AfxEnableControlContainer();
  
  #ifdef _AFXDLL
      Enable3dControls();         // Call this when using MFC in a shared DLL
  #else
      Enable3dControlsStatic();   // Call this when linking to MFC statically
  #endif
  
      INITCOMMONCONTROLSEX InitCtrlEx;
      InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX);
      InitCtrlEx.dwICC  = ICC_PROGRESS_CLASS;
  
    if (!InitCommonControlsEx(&amp;InitCtrlEx))
    {
        printf("Common Controls failed to initialize");//debug
    }
  
      CCameraSimulationDlg dlg;
      m_pMainWnd = &amp;dlg;
      int nResponse = dlg.DoModal();
  </code></pre>
  
  <p>...</p>