version compatibility problem in OCX!

Hi guys,

I had created an ocx some days ago with few functionalities and tried using it in few of my projects.

But today I had to add some extra properties to the ActiveX control. So I did. But when I did it gave me an error as follows:

"Unable to set the version compatible component"

So I searched thru the net, for some help and how to go abt debugging this. I did get some some insight to what the problem is, but still not clear on the steps that I should follow when in future I need to recompile my ocx control and distribute it.

These are those links which I found useful:

http://www.g7x.com/Help/How%20to%20Make%20Visual%20Basic%20Keep%20the%20Same%20Class%20ID.htm

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconusingversioncompatibility.asp

In the second link..the "see also" gave some info(good one's)

I remember, I had tried putting my ActiveX control on to an ASP page for checking. What I understood from the above articles are that whenever one compiles an ocx it gives different classid's to it. Therefore the earlier classid's should be mentioned or referenced whenever one is making a new .ocx. Is that right?

It would really help, if someone could help me or explain how the whole thing works and what are the things that I should consider before compiling my ocx and distributing it.

Thanks
-priya

LVL 2
priya_pbkAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
corvanderlindenConnect With a Mentor Commented:
>>ONCE AN INTERFACE IS DEFINED IT MUST NEVER EVER CHANGE

In practice this is true as soon as you have deployed the first client of that component

>>still how does one do the implement thing here if at all I need to change the properties etc

define your interface in a PublicNotCreatable class lets say ICar. Here you put empty methods and properties

Sub Initialize(ByVal DLClassname As String)
'
End Sub

In your public creatable class Car, after Option Explicit you put

Implements ICar

When you now click the left upper combobox there should be an ICar. Select this and then in the right upper combobox you have your properties and methods

0
 
priya_pbkAuthor Commented:
Also these links were useful, but little bit unclear:

http://www.g7x.com/Help/Version%20Compatibility.htm
0
 
killer5Commented:
some helpful tips ...
1. check the UPGRADE ACTIVEX CONTROLS Property in the General Tab of your Project Properties.
2. Before compiling, make sure that it will still support the functionalities of your previous version (!!!)
3. Always backup your old versions.
4. You can change the ActiveX file path your project is referencing to by opening the .vbp file in notepad. you will see something like this. (you can do this also to any .frm)

Object={E7ECAA04-2BE9-11D6-BA5B-00105A7370AF}#12.0#0; MyControl.ocx

***you can change it like this (you don't have to worry about the ID and version) just change the path.

Object={E7ECAA04-2BE9-11D6-BA5B-00105A7370AF}#12.0#0; D:\MyControls\MyControl.ocx
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
corvanderlindenCommented:
When you build an ActiveX (DLL or OCX or EXE) you have to have a so called version compatible component. It all has to do with COM and Interfaces. As you know, once an interface is defined you may never ever change it !

To give VB to possibility to check whether your interface is still compatible you have to take the following steps:

1. When you compile your component for the first time, compile it in a \compatible directory (or at least under a different name)

2. Then in the make TAB reference this compiled file as the binary compatible version

3. Compile your component in your bin (or whatever) directory

By taking step 2 VB now has the possibility to warn you when you are about to break binary compatibility (change your interface). You can break compatibility, but your old clients will not work anymore with your new component, because your new component gets new GUID's UID's etc. while your old clients have the old GUID's UID's etc compiled into them.
0
 
Éric MoreauSenior .Net ConsultantCommented:
>>"Unable to set the version compatible component"

You normally get this error when opening your source code project and when the compiled component (.DLL or .OCX) is not into the same folder as your source code. So just copy the latest version to this folder.
0
 
Éric MoreauSenior .Net ConsultantCommented:
You can also open the .vbp in Notepad and search for "CompatibleEXE32=". Check if there is a path in this value. If there is one, you need to copy your compiled component to that folder.
0
 
corvanderlindenCommented:
>>You normally get this error when opening your source code project and when the compiled component (.DLL
or .OCX) is not into the same folder as your source code. So just copy the latest version to this folder.

Correct me if I am wrong, but doesn't this say that you do not have your compatible ActiveX referenced ??

Watch out not to copy your compatible component over your production component, then you are in real trouble. Keep the two seperated as described in the link you discovered

(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon98/html/vbconusingversioncompatibility.asp)
0
 
priya_pbkAuthor Commented:
Was reading my coment, just to clarify, the error:
"Unable to set the version compatible component" came when I was trying to re-compile my activex control and not at the time of Adding new properties to the control. I could do all those, but at the time of compiling it came up with this error. I thought maybe this was not clear from my comment.

What I think, must have caused this error (this inference after reading those links)is as I said I had put this ActiveX control on one of my ASP page. Since I saw the code had some classid's and other info maybe it was still referencing it somewhere in the memory. So i deleted the ASP page. It no more gave me the above error.

Now it gives me "Persmission denied" error. This happens always when one places an AciveX control on a web page. Gets solved after you restart the computer which has the dll or ocx(can afford since it is my pc).

I was wondering how does this happen in the "real world". I think there must be those huge appln and programs which must be using dll and ocx, how do they go abt this?(I really want to know)

I really feel there must be a proper way to create an ActiveX control or a dll, so that one can debug it and scale it up whenever necessary by adding the extra properties and putting it across in the web page and not so in such a cumbersome way. What say!!

Is there no clear cut way!!

thanks,
-priya
0
 
corvanderlindenCommented:
I know little about ASP programming.

I programmed, and still do, quite a few big, commercial windows apps for my companies. They always included one or more ActiveX components (DLL's, OCX, EXE). If you obey to the rules (as described in your links) there are no problems debugging and scaling up the components. Just remember the most important rule:

ONCE AN INTERFACE IS DEFINED IT MUST NEVER EVER CHANGE

Do you want to extend your component(s) with extra properties, methods and so on, just implement a second interface !
0
 
priya_pbkAuthor Commented:
so how does one implement a second interface. Does implementing interface means simlar to Java interface. I mean like Java implements Runnable ..like that?

I have not used 'implements' in vb. How do I do it.

And as you said,
"ONCE AN INTERFACE IS DEFINED IT MUST NEVER EVER CHANGE"

means one can never add properties, methods or events to a control or dll other than implementing it.

How do I scale it up?

 



0
 
AzraSoundCommented:
>>ONCE AN INTERFACE IS DEFINED IT MUST NEVER EVER CHANGE

If you have already set binary compatibility then this is true, as it will break that binary compatible component.  Using project compatibility during development is a good idea until you feel your component's interface definition is stable, and will not be altered...then switch over to binary compatibility.
0
 
priya_pbkAuthor Commented:
still how does one do the implement thing here if at all I need to change the properties etc

-priya
0
 
priya_pbkAuthor Commented:
thanks very much, all of you guys!!! -priya
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.