Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
  Tip: Lost COMCTL32.OCX  
 
 

By Amy Carlstrom

Recently I decided to remove a second partition I had put on my hard drive. I had to format and reinstall Windows. After having done this, I ran into a bit of a problem with my Visual Basic project files that used the COMCTL32.OCX dialog control. Upon trying to load them with Visual Basic (the same version I used to create them, there was no change in that) it would display the following error message:

    'COMCTL32.OCX' could not be loaded -- Continue Loading Project?
Well, I searched the internet extensively for some solution to my problem. Everywhere I looked, the same solution was presented. I would need to go into the registry editor, delete the registry key for the control, then re-register it.

Supposedly, after doing this, everything should have been fine. There were a few different ways that were offered on how to do this, from going into the registry editor manually and deleting the key, to using a program called RegClean. I tried multiple times, using different approaches, but none of this made any difference.

At this point, I was frustrated. I decided to go into the project files with Notepad and see what I could find there. Once I had the main project file opened, I could see exactly where the control was called. It was at the top of the file and looked like this:

    Object={6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0;..\..\..\..\SYSTEM\COMCTL32.OCX
Well, I opened the file of the form that used the control and, surprise surprise, I found a similar line that looked like this:
    Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.3#0"; "COMCTL32.OCX"
First, I compared the key, since it listed the key in the files, to the one in the registry editor, to make sure they matched. Not only did they match, but it was the key that was listed on the MicroSoft website as belonging to the control. So I knew that couldn't be it.

Then I checked that it pointed to the correct folder where the control could be found -- all those dots and slashes do eventually add up to the C:\WINDOWS\SYSTEM folder. So it was looking in the right place.

Last, I noticed the part that says "#1.3". I remember from looking in the registry editor that the folder where the control was registered was listed as version "1.2". I wondered if that could be it.

Since the project file wasn't working and I had run out of solutions, I figured I couldn't screw it up any worse. I decided to take a gamble. I changed the "1.3" in each of the lines to "1.2" and saved both the project and the form files. I crossed my fingers and loaded the project up in Visual Basic. Viola! The project loaded with no errors and the controls were on the form, right where they were supposed to be.

So I'm writing this to you so that you can hopefully add it to your site, providing a new solution to an old error, and maybe saving someone a lot of trouble down the line (like I went through).

Thanks Amy!

 

Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated