How do I develop the same VB6 app from different computers without getting missing OCX or DLL errors?

Posted on 2006-03-27
Last Modified: 2010-05-18
I develop applications from different computers. One is at work, one is at home and a laptop while on the road. All of them have the same version of VB6 Professional installed with the same service pack (sp6). All development computers are Windows XP SP2 desktops / laptops.

I don't have access to a central source code control application (on the internet?), but if that would help, I would look into it.
Typically I work on an application at home, then transfer all of the files to a USB disk and copy them to a folder at work.  The problem I have is when I open the project file in VB6 IDE, it gives me an error like this:
C:\Data\programming\source\vadvocate\lvButton.ocx could not be loaded.
Then I get an error log file for every form that has the OCX file on it. The buttons (in this case) are changed to picture boxes and the OCX file is no longer referenced as a component. The error looks like this:
Line 55: Class lvButton_H.lvButtons_H of control btnClose was not a loaded control class.

I also sometimes get an error in the References box where it shows some DLL or control as MISSING:....

Note:  This does not happen with the included VB controls and referenced Microsoft DLLs and OCX files - only with third party DLLs or OCX files.

The OCX file has never been located in the folder with the application source, but in a different place. I believe the problem may be related to the registered OCX file being in different places on the different developer computers.

I can usually resolve the problem in one of 2 ways.  1): Go to Project:Components and select the OCX file and then replace all of the picture boxes with the component, then re-save the project (VERY time consuming)  2: Go to Project:Components and select the OCX file; open 1 form and put a new control (button in this case) on the form, then close it. Close the project and make sure that I ONLY save the VBP file, not the changed form.
This seems to work, but is clunky at best and takes a lot of time. When I select the control in the Components dialog box, it's still shown there, but is not checked. The control is referenced in the VBP file as:
Object={27F22AE7-75C1-4413-A7E2-8536E6C04D5B}#1.0#0; lvButton_H.ocx
The value in the brackets is different after I've re-selected it - looks like this:
Object={6E42274A-EF84-4B2B-82FB-5B2598CF6A39}#1.0#0; lvButton_H.ocx

I would like to know if there is a better way to do this. How do I avoid this issue when developing the same application on two or more computers? In other words, what is the best way to do this (without access to a central server / repository that holds all of the source code files and components)?


Question by:weiroblpay
    LVL 28

    Expert Comment

    You could create a setup application using the P&D wizard or another setup program such as inno setup. This way the setup program can include the ocx files as well as register them. You could also add your ocx/dll files to your system directory and then register them using:

    regsvr32 Somefile.ocx
    LVL 13

    Expert Comment

    Need to set binary compatibility on the OCX and DLL components.  What's happening is each time you compile without binary compatibility, your OCX and DLL components are assigned new IDs in the registry.  Let's say you compile at work.  The source code is updated to point to these new IDs, but those IDs don't yet exist in the registry on your home computer, so when you open your project at home, you get the "MISSING" etc.  If you manually registered (using regsvr32) your OCX's and DLL's prior to opening your project, it should work fine.  But the best answer is binary compatibility, which "locks" the IDs so the same ones are used each time you compile.  (Note, binary compatibility also requires that you don't change or remove any public members of your component interface, so if you're making a lot of changes to the OCX's and DLL's go with the manual registration idea instead).
    LVL 1

    Author Comment

    Thanks for your replies, but I guess I need to clarify.

    My problem is because I'm editing the source code on 2 different computers. The source code references a Third Party OCX or DLL; not one that is being developed in my application. I can't use the binary compatibility (or any other compatibility option) because the DLL or OCX that I'm having trouble with is one that I select in the Project: Components menu.
    The acutal OCX or DLL file is a complied component to which I don't have source code access. It's just another reference in my application, like the Microsoft Windows Common Controls (MSCOMCTL.OCX). I have full rights to use the OCX file and develop and distribute it, but no source code.

    I use INNO setup and if I compile and create a setup and run that on another system, everything works fine. It's just while developing that I have the problem. The third party OCX that I have problems with is registered properly on all computers that I use, but not always in the same folder on each one.

    Does that help?  I need to be able to copy my source code from one computer to another and continue developing it without always getting errors because VB can't seem to find the location of the third party OCX file that's included as a component in my project, even though it's registered properly. I'm pretty sure it has something to do with the CLSID entries in the registry, and/or the actual physical path to the OCX file, but I haven't figured out yet how to resolve that.


    LVL 9

    Assisted Solution

    VB6 'loses' references, it's a known problem.  

    Ran into the same problem on complex app, but we were using Source Safe.  Short term solution was to open the project, uncheck all the components, save the VBP and close the project.  Reopen the project, select the components, save the VBP then proceed.  Yep, that's a pain in the butt.

    We devised a solution, but I don't think you'll find it useful.  Our solution was the inelegant application of brute force and money.  A box was built that had all the software used by the developers. An image was taken from that box and applied to all the developer's C drives, so we were all using the same environment.  Every time an OCX or program had to be added or upgraded, a new image was taken and applied.  We had rack mount hard drives and an extra hard disk for each developer so changing the environment took as long as a reboot.
    LVL 1

    Author Comment

    So this is just a 'known' problem the Microsoft never addressed?

    I thought there may be a much better solution rather than an ugly brute force or kludge type solution. Any other possibilities?

    LVL 9

    Expert Comment

    >So this is just a 'known' problem the Microsoft never addressed?
    No clue.  Could be that it was too difficult to reproduce.  

    I don't know of any other ways to fix the problem.
    LVL 8

    Accepted Solution


    Not too sure if this helps, but with some experience with ocx/dlls that came with VB, sometimes I do this:

    Computer 1:
    Copy/duplicate the ocx/dll into the same working folder of that app.
    Assuming path is C:\myApp
    Start a project in the folder with that ocx/dll in it.
    For adding of component, browse for and add that duplicated ocx file
    <happy coding...>

    Then, going on to computer 2:
    create directory: C:\myApp - same name, path
    dump into it all the ocx, vbp and .from files - everything copied from Computer1 - C:\myApp
    Run the project
    <happy coding part 2...>

    Prehaps it may work... Sometimes I still do get errors here and here - can't remember too clearly from my deep sea of memory =P

    That's it!

    glass cookie =)
    LVL 1

    Author Comment

    Thanks dancebert and  glass_cookie.
    I'll try this out and come back...
    LVL 1

    Expert Comment


    The problem is then its been installed the 3rd party ocx on diferent computers but diferent minor versions, and on diferent paths.

    there are two solucions i can tell
       if you open your .vbp file with a text editor you can find at the begining declarations of what components are registered on it, just find de one with problems and replace the key and path to the corresonding on the pc you want to develop.

       the next lines are an example of a vbp file opened with notepad  (

      Reference=*\G{00020430-0000-0000-C000-000000000046}#2.0#0#..\..\WINDOWS\System32\STDOLE2.TLB#OLE Automation
      Reference=*\G{3B008041-905A-11D1-B4AE-444553540000}#1.0#0#..\..\Program Files\Rational\common\vsocx6.ocx#:-) VideoSoft vsOcx6 Controls

      The second line started with reference shows the key and path of the 3rd party file "Video vsOcx6 Controls"

      Reinstall same minor version in same path in all PCs.

    LVL 1

    Author Comment

    Thanks for the help.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now