Old VB6 OCX problem on Server 2008 R2 RRS feed

  • Question

  • In our company, we have an old VB6 application, based on COM+ and ADO 2.6. One of our customers recently started to complain that our application does not work on Windows Server 2008 R2.

    To reproduce the scenario, we created a VM with Windows Server 2008 and installed the app (as administrator). The app worked perfectly. But then we logged with another user (User_1) on the machine, and we received the following message:

    339 - Component 'MSCOMCTL.OCX' or one of its dependencies not correctly registered: a file is missing or is invalid.

    Our first thought was: lack of permissions.

    To test this theory, we added User_1 to the administrator's group. It didn't work. After some tries, we installed the app again, logged as User_1. The app started to work normally for User_1 and administrator. But then, when trying to access as User_2, we received the same message.

    Our conclusion is: If we install the app with the user, it works for him. For another user, it does not work. So, probably, during installation the app configures something that only that user can see.

    Seaching the internet, we found that Windows Server 2008 R2 is compatible with this OCX (http://msdn.microsoft.com/en-us/vbrun/ms788708.aspx). We've been trying to find the reason behind this behaviour.

    Anyone has a suggestion?

    Thursday, November 26, 2009 4:29 PM

All replies



    Component MSCOMCTL.OCX or one of its dependencies not correctly registered

    Solution 1:

    MSCOMCTL.OCX is a Microsoft Library Windows Common Controls file. Occasionally when a Windows user is installing or uninstalling a bunch of software, certain Microsoft Libraries can become unregistered . One such file that can become corrupt or lost is the MSCOMCTL.OCX file. Then, when the user runs a program or application that requires or is dependent on this file, they may be presented with the following error:

    Component 'MSCOMCTL.OCX' or one of its dependencies not correctly registered: a file is missing or invalid MSCOMCTL.OCX error screenshot:
    Error MSCOMCTL.OCX Screenshot
    How to Correct or fix this dependency error:

    1.         First search your local drive for MSCOMCTL.OCX to see if it is missing. The path to the file is typically: C:\WINDOWS\system32 (or) typically C:\Winnt\ system32\COMDLG32.OCX

    2.         If the file is missing you can download it

    3.         Once downloaded, click the MSCOMCTL.exe and extract the file to your C:\WINDOWS\system32 directory (or) C:\Winnt\ system32\COMDLG32.OCX

    Note: Some users may need to perform this additional step to register the file:

    1.         Click Start -> Run and type REGSVR32 MSCOMCTL.OCX

    Solution 2
    :well the best alternative is to go with Package and deployment wizard....

    But, If you'd like to register them manually through the code then use this...

    Private sub Form_load()
    Shell "REGSVR32 /s c:\winnt\system32\mstask32.ocx"
    End Sub

    Thanks and Best Regards
    Anil Inampudi.

    Sample Code Disclaimer



    NOTE - Disclaimer


    By using the following materials or sample code you agree to be bound by the license terms below and the Microsoft Partner Program Agreement the terms of which are incorporated herein by this reference. These license terms are an agreement between Microsoft Corporation (or, if applicable based on where you are located, on of its affiliates) and you. Any materials (other than sample code) we provide to you are for your internal use only. Any sample code is provided for the purpose of illustration only and is not intended to be used in a production environment. We grant you a nonexclusive, royalty-free right to use and modify the sample code and to reproduce and distribute the object code form of the sample code, provided that you agree: (i) to not use Microsoft's name, logo, or trademarks to market your software produced in which the sample code is embedded; (ii) to include a valid copyright notice on your software product in which the sample code is embedded; (iii) to provide on behalf of and for the benefit of your subcontractors a disclaimer of warranties, exclusion of liability for indirect and consequential damages and a responsible limitation of liability; and (iv) to indemnify, hold harmless, and defend Microsoft, its affiliates and suppliers from and against any third party claims or lawsuits, including attorney's fees, that arise or result from the use or distribution of the sample code.



    Monday, December 14, 2009 2:49 PM
  • Did you find a resolution for this?  I have a similar situation when trying to run a VB6 app in remote desktop services from a win 2008 R2 machine.  It works for the first couple and not the next few users.
    Tuesday, December 7, 2010 7:11 PM
  • I have the exact same problem. In my company we have an older application that runs on terminal services. I noticed that only the users that started the application (and were previocly logged in on the server at some point) before the components are registered don't have an error message. If a new user tries to start the application the error Component 'SomeCommponent.OCX' or one of its dependencies not correctly registered: a file is missing or invalid SomeCommponent.OCX apears.

    I need to register the component again so that the new users don't get the error. 

    Anny suggestions on how to register ocx or dll components for all users?



    Tuesday, September 27, 2011 8:28 PM
  • I have the same problem. After i changed IP address to the PDC (SBS2008) all user's session on a terminal server of the same Domain give:

    "or one of its dependencies not correctly registered" for all "non admin" users.

    Any suggestions?


    Wednesday, December 14, 2011 7:53 PM
  • If it is of any help, I unregistered the components (they were in syswow64), copied them int c:\windows and registered them again. The problem disappeared.
    • Proposed as answer by John Smith 3 Tuesday, November 13, 2012 3:33 PM
    Tuesday, December 20, 2011 10:27 AM
  • We've seen the same thing in a Citrix environment. And resolved in the following way:

    Turned off UAC

    Open a cmd as an administrator to "change user /install"

    Installed our application in a separate process

    reboot or "change user /execute".

    Monday, September 10, 2012 3:12 PM
  • Confirmed damemalov's solution. 

    Windows 2008 R2 Datacenter Edition.  Running regsvr32 mscomctl.ocx in C:\Windows\SysWOW64 resulted in success message "DllRegisterServer in mscomctl.ocx succeeded".

    However, our old VB 6.0 app continued to fail with the message "Run time error '339' Component 'MSCOMCTL.OCX' or one of its dependencies is not correctly registered; a file is missing or invalid."

    The error was user-specific.  The user who performed the install was able to execute the application, but other users were not.  Ironically, running the application as administrator also failed.

    Action:  Unregistered mscomctl.ocx in SysWOW64, made a copy in C:\Windows, and registered the copy using the version of regsvr32 in SysWOW64.  E.g., from a command line or batch file, running as administrator:

    C:\Windows\SysWOW64\regsvr32 C:\Windows\mscomctl.ocx


    Tuesday, November 13, 2012 3:30 PM
  • Hi,

    We have windows 2003 x86 currently running vb application . We are migrating to new windows 2008 R2 x64 OS and getting error for MSCOMCT2.OCX We had installed ms office pro plus 2010 for x86. Error is " your microsoft access databsae or project contains a missing or broken refernce to the file MSCOMCT2.OCX version 2.0 " .

    How do i download MSCOMCT2.OCX file and register it ? OR do i need to install visual studio 2010 or visual studio 2013 ? Can someone tell if visual studio 2005 is compatible on windows 2008 R2 x64 bit OS ?

    User access the application via citrix.

    Appreciate your help




    • Edited by AHVisani Tuesday, July 8, 2014 1:49 PM
    Tuesday, July 8, 2014 1:48 PM