1

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?

Machavity
  • 30,841
  • 27
  • 92
  • 100
jyothis
  • 49
  • 2
  • 3
  • 7

8 Answers8

3

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
Mehran
  • 1,409
  • 2
  • 17
  • 27
1

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

Hrqls
  • 2,944
  • 4
  • 34
  • 54
  • yes the project has lost the reference to the ocx. I tried to add reference but when i check the 'microsoft windows common controls 6.0 (sp6)" i get the error that the control cannot be loaded and the control get unchecked. Please advice more... – jyothis Dec 20 '12 at 09:52
  • i think the fastest solution for you is to uninstall visual basic, and reinstall it ... that saves a lot of time which you probably would have to spend searching for the cause or solving this problem another way – Hrqls Dec 20 '12 at 10:35
  • yes i have re installed vb but the problem still persists.What more can i do?? i need to prepare an exe of the application. Please advice on this... – jyothis Dec 20 '12 at 12:20
  • did you really uninstall vb6 first ... then reboot .. and then reinstall ? or did you reinstall without removing the old one? .... another thing you can try is to create a new project and copy all the stuff from the old project into this new one .. it might be that only your project file is corrupted, so creating a new one might help – Hrqls Dec 20 '12 at 22:03
  • 1
    This worked for my case. Of note, when I did this it changed the name to lowercase as well as changed the version from 2.2 to 2.0 as in 2.2 MSCOMCTL.OCX became 2.0 mscomctl.ocx – SoEzPz Mar 08 '21 at 20:58
1

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

Nathan Hadley
  • 100
  • 1
  • 10
1

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.

Don
  • 11
  • 2
0

Try re-registering MSCOMCTL.OCX:

  1. download the file: http://www.ocxdump.com/ocxfiles/M/MSCOMCTL.OCX
  2. copy it in location c:\windows\system32\
  3. open command prompt and run this:

    cd c:\windows\system32
    regsvr32 MSCOMCTL.OCX
    

Than try to run your application again.

Deanna
  • 23,876
  • 7
  • 71
  • 156
Kresimir Pendic
  • 3,597
  • 1
  • 21
  • 28
  • I did the same as you advised, but still i am facing the same issue.Please advice more on this. – jyothis Dec 19 '12 at 09:49
  • @jyothis When you ran Regsvr32, did it complete successfully or throw an error; were you running from an account with administrator privileges? – Matt Donnan Dec 19 '12 at 11:34
  • and what happens now when you run your application? does it complain about the same error or ? – Kresimir Pendic Dec 19 '12 at 13:23
  • try to download and instal VB CC6 from MS website and try again http://www.microsoft.com/downloads/details.aspx?FamilyId=25437D98-51D0-41C1-BB14-64662F5F62FE&displaylang=en – Kresimir Pendic Dec 20 '12 at 13:40
0

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

StayOnTarget
  • 11,743
  • 10
  • 52
  • 81
Hrqls
  • 2,944
  • 4
  • 34
  • 54
  • Please advice...how shal i search for the key using regedit?? – jyothis Dec 20 '12 at 09:58
  • copy the part between the { and } .. then start regedit (windows start menu - execute - regedit) ... then press ctrl-F and paste the key to search – Hrqls Dec 20 '12 at 10:34
0

I had this same error. These 2 things worked for me:

  • Start Visual Studio 6 by right-click Run as Admin

or

  • Disable the UAC prompt.

hope it helps.

Sunjen
  • 85
  • 1
  • 7
0

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.

Chris
  • 1
  • 4