Click to See Complete Forum and Search --> : A problem with GUID??!!


edward_ce
November 11th, 1999, 12:18 PM
I have a completed project that had been running for six months without any failure. This program is composed of two projects: an ActiveX control project, and the main program project. These two projects reside together in one project group. The ActiveX control project is compiled into an OCX file.

One day, for some reason, I went to the VB6 IDE and changed the logical name of my ActiveX control project. I changed only the logical name, not the physical name (.vbp) of the ActiveX control project. I re-compiled the ActiveX control project. From then on, a series of error messages had ensued. I remember that during the course of fixing the problem, I chose NO COMPATIBILITY in the Components tab of the project properties for my ActiveX project.

There was a time that I deleted all entries in the Windows registry pertaining to my ActiveX component. Then recompiled the ActiveX project only to get a series of error messages when I tried to recompile the main program project.

During the course of trying to fix the problem, I got the following error messages:

"Version 7.0 of .ocx is not registered. The control will be upgraded to version 13.0"

"Version 9.0 of .ocx is not registered. The control will be upgraded to version 16.0"

The present error message that I get when I open the Project Group within the VB6 IDE is "Error during load. Refer to 'C:\My Programs\frmMyForm.log" for details.

When I look at the contents of the .log file, it says that the class of a control was not a loaded control class. For example, the .log file would say something like "Line 18: Class MyComponents.MyControl of control ctlMyControl was not a loaded control class.

Everytime I try to compile the main program project, I get errors like: "Method or data member not found" which refers to the ActiveX MyControl.

Please help!!! I would appreciate your much sought-after answer to this problem.

santulan
November 12th, 1999, 09:23 AM
Just give a try boss!!!
You recompile the OCX project and then add it to your current project and compile your current project...

May god help you in that way...
let me know too


Santulan

Chris Eastwood
November 12th, 1999, 10:19 AM
Welcome to the wonderful world of Binary Compatibility.

When you compile your program with 'No Compatibililty' a new GUID is created each time it is compiled, hence when you change something in the project and recompile, you get a different version number.

The old VB5 Books-On-Line had a good section on binary compatibility and how to use it (I haven't checked the MSDN that comes with Vb6 as it's a PITB to install on my home machine).


The problems you're having with your client are because it no longer knows about the interface of your component. what you should do is :

1. Load the client project

2. Ignore errors that say 'component xxx couldn't be loaded'

3. goto project->components (or references if it's a dll) and uncheck the missing reference / add in the new version of your component.

4. save only the project file (vbp) and quit from vb

5. reload your project and all the references should be in place.

You still need to understand Binary compatibility though and a good read through the MSDN is always ideal - You should basically develop your ActiveX Components / Controls as such :

1. When you are (dead) sure that it's done and tested, compile the active x component, eg. mycomponent.ocx

2. Copy the mycomponent.ocx to a new file called mycomponent.cmp (extension isn't important)

3. In your project properties, mark the project as being Binary compatible with the new 'mycomponent.cmp' file.

4. recompile your project (just to make sure).

Now your main EXE program can always reference the activex component as long as you don't break compatibility - see the msdn for a list of possible ways you can do this (changing interfaces, removing routines, renaming projects etc).

Should you need to change your component in the future, as long as you haven't broken compatibility then you can just ship the new ocx/dll to your users.


Chris Eastwood

CodeGuru - the website for developers
http://codeguru.developer.com/vb

edward_ce
November 16th, 1999, 11:12 AM
This is in reference to Mr. Chris Eastwood's reply to the post "A problem with GUID??!!".

As enumerated in his recommended procedure to solve this problem, he stated in Step # 3 this: "go to Project->Components and uncheck the missing reference. Add in the new version of your component."

I couldn't find a MISSING message in the Project->Components dialog. But my OCX is listed although it is not selected (no check mark). I did the following steps:

1. Load the project group and ignore the error messages
2. Compile OCX project using NO COMPATIBILITY option
3. Save the OCX project and quit VB6 IDE.
4. Load VB6 and open the project group.
5. Highlight the main project (not the OCX project) from Project Explorer.
6. Go to Project->Components then check the OCX
7. Save the main project.
8. Quit VB6 IDE.

And behold! The next time I reloaded my project in the VB6 IDE, all the references were perfectly in place - no form loading errors appeared anymore. I got my senses back again.

But when I tried to compile the main project, the same problem came up. I keep on getting the same compilation error as before: "Method or data member not found". The error points at an instance of the custom control.

When I press SHIFT-F2 (go to definition) while the cursor was positioned in the wayward instance of the custom control, I get the following error message:

"Cannot jump to ctlXXX because it is hidden"

It was then when I noticed that all instances of the custom control in the form were dimmed (or grayed out). And horror of horrors! After thorough scrutiny I found out that the instance of my custom controls were all redefined as PictureBox. What a great miracle (or could it be Microsoft magic?).

Magic or no magic, that would sure make you scream. (I'm sure I didn't accidentally make the redefinition of the controls myself - not even during my fit of temporary insanity, LOL!).

Anyways, I did solve the problem in no time at all. I got the backup copy. What a brilliant solution, isn't it?

If I never had the backup, how can I put those unwanted PictureBox controls back to their original definitions (and glory)? Please, don't tell me that I have to create the form again.

Is there a way to get back the original control definitions?