Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

version compatibility problem in OCX!

Posted on 2002-05-27
13
814 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
ID: 7038476
Also these links were useful, but little bit unclear:

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

Expert Comment

by:killer5
ID: 7038520
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
ID: 7038646
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 
LVL 70

Expert Comment

by:Éric Moreau
ID: 7038893
>>"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 70

Expert Comment

by:Éric Moreau
ID: 7038898
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
ID: 7038945
>>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
 
LVL 2

Author Comment

by:priya_pbk
ID: 7039055
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
ID: 7039122
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
ID: 7039169
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
ID: 7039222
>>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
ID: 7039248
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
ID: 7041066
>>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
ID: 7140251
thanks very much, all of you guys!!! -priya
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…

840 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