Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

project won't open on second computer

Status
Not open for further replies.

OrthoDocSoft

Programmer
May 7, 2004
291
0
0
US
Hi folks,

I have a project the loads and runs fine on computer #1. When I move the project file to a second computer with exactly the same file path, I get loading errors related to not being able to find mscomctl.ocx registered in the exact same file path (i.e., my project's file path -- odd in itself). So I "registered" the ocx in the file path (worked), so I don't see that error any more, but bits of forms won't load still. When I look in the error document for the form, I see comments like this:

"Line 14: Class MSComctlLib.ImageList of control ImageList1 was not a loaded control class."

Can anyone help me get this right? Basically, I'm trying to have at least two XP machines with copies of my program running at all times..

Thanks
Ortho

[lookaround] "you cain't fix 'stupid'...
 
I assume these machines do not have VB6 installed. If they do you have bigger problems.

It sounds like you have a faulty installer though. That library should never be in the same folder as an application.
 
> When I move the project file to a second computer

Move how?
 
With a compiled exe you should get a fatal dependency error. Since you have a "form.log" file containing the error you mention, I assume that you have VB6 installed on computer #2 and are getting this error when loading or running the project in the IDE.

There may be several reasons for this error...

1. mscomctl.ocx is missing or not correctly registered
2. mscomctl.ocx is not referenced in the project
3. mscomctl.ocx is incorrectly referenced in the project

Firstly, NEVER copy OCX files to the app path and register them there. ALWAYS copy them to the system path.

The simple reason for this is that the registration process is system wide. In other words, no matter where you copy the file to, when you register it, it will overwrite any registration settings for the same file located somewhere else. This will only create problems in the end. Stick to good practice, and place all OCX files in the system path. (eg: C:\WINDOWS\system32)

I suggest that you try this:

BACKUP YOUR ORIGINAL PROJECT IN FULL BEFORE STARTING!

1. unregister and delete the ocx from the local path
2. copy the ocx to the system path and register it
3. delete your project files (*.vbp, *.frm, etc)
4. copy your project again - DO NOT LOAD OR RUN IT IN THE IDE YET
5. if present, delete the "<project name>.vbw" file (this will ensure that no forms open up in the IDE when you first open the project)

Try opening the project in the IDE - DO NOT RUN IT!

Is there any error? If so, then goto Components, and check that "Microsoft Windows Common Controls (SP6)" is referenced (ticked). If not, then re-referencing it may be all that is needed to fix the problem.

If all else fails, or if you have lots of controls that you don't want to delete and re-add to every form, then you can try the following. (I've written this specifically for "mscomctl.ocx", however I've done this many times before when updating controls that are not binary compatable, and it has always worked.)

BACKUP YOUR ORIGINAL PROJECT IN FULL BEFORE STARTING!

1. open the VB6 IDE and create a new exe project
2. add a form if one is not added automatically
3. open Components and add "Microsoft Windows Common Controls (SP6)"
4. add an imagelist, listview or treeview to the form
5. save the project to a temp location using the default filenames, and quit the IDE
6. goto the temp location and open the "Project1.vbp" file in a text editor
7. in the vbp file, find the reference to "mscomctl.ocx" which should look something like the following (it should be somewhere near the top):
Code:
Object={831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0; [b]mscomctl.OCX[/b]
8. open your app's project file in the text editor, and find the reference to "mscomctl.ocx"
9. replace (copy and paste) the reference to "mscomctl.ocx" in the app project file with the one from the temp project file, and save the modified app file
10. open the temp form file (Form1.frm) in the text editor
11. find the reference to "mscomctl.ocx" which should look something like the following (again, it should be somewhere near the top):
Code:
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.1#0"; [b]"MSCOMCTL.OCX"[/b]
12. copy this line to the clipboard
13. open all the form files (*.frm) from your app in the text editor
14. in each file, locate the reference to "mscomctl.ocx" and replace it with the one you copied from the temp form file
15. save the modified file
16. repeat steps 13 - 15 for User Control files (*.ctl) and Property Page files (*.pag) as necessary.

This should fix all the reference in your app. You should now be able to open your project in the IDE and run it without any error.





Heaven doesn't want me, and Hell's afraid I'll take over!
 
Better yet, just install VB6 correctly in the first place, and only on development machines.

Easier said than done these days, true, but that's just part of keeping VB6 viable. If you can't hack it, there's always the kid-friendly VB.Net instead. ;-)

But once misinstalled no amount of gyrating is going to make it right. You'll be applying Band-Aids forever as various landmines blow your feet off.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top