Solved

version compatibility problem in OCX!

Posted on 2002-05-27
13
731 Views
Last Modified: 2009-05-11
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

0
Comment
Question by:priya_pbk
  • 5
  • 4
  • 2
  • +2
13 Comments
 
LVL 2

Author Comment

by:priya_pbk
Comment Utility
Also these links were useful, but little bit unclear:

http://www.g7x.com/Help/Version%20Compatibility.htm
0
 
LVL 1

Expert Comment

by:killer5
Comment Utility
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
 
LVL 2

Expert Comment

by:corvanderlinden
Comment Utility
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
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
>>"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
 
LVL 69

Expert Comment

by:Éric Moreau
Comment Utility
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
 
LVL 2

Expert Comment

by:corvanderlinden
Comment Utility
>>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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 2

Author Comment

by:priya_pbk
Comment Utility
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
 
LVL 2

Expert Comment

by:corvanderlinden
Comment Utility
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
 
LVL 2

Author Comment

by:priya_pbk
Comment Utility
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
 
LVL 28

Expert Comment

by:AzraSound
Comment Utility
>>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
 
LVL 2

Author Comment

by:priya_pbk
Comment Utility
still how does one do the implement thing here if at all I need to change the properties etc

-priya
0
 
LVL 2

Accepted Solution

by:
corvanderlinden earned 50 total points
Comment Utility
>>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
 
LVL 2

Author Comment

by:priya_pbk
Comment Utility
thanks very much, all of you guys!!! -priya
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

763 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

7 Experts available now in Live!

Get 1:1 Help Now