When attempting to open a SocketTools example project for Visual Basic 6.0, the error "Class MSComctlLib.ClassName of control ControlName was not a loaded control class" is displayed.
More Information
The actual name of the common control class will vary depending on what control the project references, such as ProgressBar, StatusBar or TreeView; however the error always indicates a Windows Common Control name. Visual Basic will generate a logfile that lists the control or controls that could not be loaded, along with various invalid property names.
This error occurs when one or more of the Microsoft Windows Common Controls are not registered, or the registry information has been corrupted. There are three common controls components available for Visual Basic 6:
mscomctl.ocx | Microsoft Windows Common Controls 6.0 |
mscomct2.ocx | Microsoft Windows Common Controls 6.0-2 |
comct332.ocx | Microsoft Windows Common Controls 6.0-3 |
Most of the SocketTools examples for Visual Basic 6 use the first common controls component (mscomctl.ocx), but there are several that may use the others as well. To fix this problem, it is recommended that you re-register each of these components using the regsvr32.exe utility. Prior to registering these components, make sure that you have closed all running instances of the VB6 IDE. If the IDE prompts you to save any changes, do not save them to prevent the references to the common controls from being removed from the project.
If the system is running Windows Vista or later versions of Windows, the control registration must be performed with administrative privileges. To do this, you should open a command prompt by selecting Start > All Programs > Accessories and then right-click on Command Prompt. From the context menu, select Run as Administrator. With UAC enabled, this will cause a confirmation dialog to be shown.
If the system is running a 64-bit version of Windows, the components listed above will be in the C:\Windows\SysWOW64 folder. This is where 32-bit ActiveX components and DLLs are stored on 64-bit systems. Change your current working directory to that directory before registering the components.
To register the controls on a 32-bit Windows system, enter the following commands at the command prompt:
c:\windows\system32\regsvr32.exe c:\windows\system32\mscomctl.ocx
c:\windows\system32\regsvr32.exe c:\windows\system32\mscomct2.ocx
c:\windows\system32\regsvr32.exe c:\windows\system32\comct332.ocx
To register the controls on a 64-bit Windows system, enter the following commands at the command prompt:
c:\windows\syswow64\regsvr32.exe c:\windows\syswow64\mscomctl.ocx
c:\windows\syswow64\regsvr32.exe c:\windows\syswow64\mscomct2.ocx
c:\windows\syswow64\regsvr32.exe c:\windows\syswow64\comct332.ocx
After each command is entered, a confirmation message box should be displayed indicating that the control has been registered successfully. When all three common control components have been registered, re-open your project in Visual Basic 6.
See Also
DllRegisterServer Fails with Error 0x80040200
ActiveX Component Can’t Create Object
How to use the Regsvr32 tool and troubleshoot Regsvr32 error messages