I have a VB project was able to work without any issues, but now when i open the project i am getting the error with mscomctl.ocx. I have re-registered the ocx but still am not able to load the project.
How can I fix this problem?
I was having this issue when I open the project on Windows 7 64-bit environment, it works correctly on win XP machine. I did a very simple change in project file earlier it says
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0; MSCOMCTL.OCX
I changed 2.1 to 2.0 because I have seen it like that in many forums and it worked like charm.
The updated reference in VBP file is
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
it seems to me your project has lost its reference to the ocx (while it still tries to use some of the controls)
click on 'components' in the 'project' menu in the ide
in the list make sure 'microsoft windows common controls 6.0 (sp6)' is checked ... if it already is, try removing it, close (and save) the project, open the project, and turn it on again
I had the same problem. user1272267 answer worked (thanks), but it bothered me that I didn't understand why, I also wasn't sure if I would end up breaking the project for my colleagues who it worked fine for.
So I did a bit more digging and found that in the registry there was a key; reg hkcr\typelib{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}\2.0 (Note the 2.0)
I changed the 2.0 to 2.1 and hey presto, everything worked fine. I also checked the DLL and it turned out my copy was older than my colleagues copy. I think this may be because when I installed service pack 6 I kept some of the original files when asked since the replacement files were for American english and I had the UK version, but i'm not 100% certain of this
I had a similar problem when my Windows 7 32 bit laptop crashed and the company replaced it with a 64 bit machine... first I tried registering the .ocx using regsvr32 - on the 32 bit machine it would get unloaded from time to time... this did not work at all on the refurbished 64 bit machine...
I tried changing the .vbp file settings as noted in some of the earlier responses without success... I set the .vbp back to 2.0 and later on another issue I was searching the registry and decided to search for mscomctl.ocx and found 3 keys - 2.0, 2.1 and 2.2... since it wasn't working I decided to delete the 2.1 and 2.2 keys and voila! the controls loaded without a problem. Clearly the .vbp and registry have to match.
Try re-registering MSCOMCTL.OCX:
c:\windows\system32\open command prompt and run this:
cd c:\windows\system32
regsvr32 MSCOMCTL.OCX
Than try to run your application again.
you can also open the project file (.vbp file) in notepad where you see something like the following:
Type=Exe
Form=frmComFX.frm
Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#C:\Windows\SysWOW64\stdole2.tlb#OLE Automation
Object={648A5603-2C6E-101B-82B6-000000000014}#1.1#0; MSCOMM32.OCX
Object={5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0; MSFLXGRD.OCX
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0; MSCOMCTL.OCX
Form=frmSetup.frm
Module=modFX; modFX.bas
IconForm="frmComFX"
Startup="frmComFX"
HelpFile=""
Title="ComFX"
Command32=""
Name="comFX"
the lines that start with 'object-' contain the registry key with which the ocx is registered ... you can now open regedit (start - execute - regedit) and search for this key .. be careful though what you do in regedit, you might screw up your visual basic installation or even your complete windows :)
of course you can also remove visual basic and reinstall it to get the registrations back
I had this same error. These 2 things worked for me:
or
hope it helps.
Windows 7 64 bit; just installed VS6 and VS6 SP6 (with difficulty)but my project from Win XP gave the "MSCOMCTL.OCX could not be loaded" error.
I found Nathan Hadley's answer gave me the clue and allowed me to open the project.... My userinterface.vbp file for the project (copied from Win XP) had #2.2 next to the MSCOMCTL.OCX reference but my registry class id had only 2.1. So I changed my userinterface.vbp entry to 2.1 and the project opened ok.
However the next day I ran the VB6 SP6 cumulative update VB60SP6-KB2708437-x86-ENU again (may have not installed properly the first time) and now I have version 2.2 in the registry. So I changed my userInterface.vbp file back so the OCX reference has #2.2 once more and now the project still opens correctly and all runs ok.