Solved

OCX Compatibility

Posted on 2001-08-17
7
406 Views
Last Modified: 2006-11-17
I built a complex OCX that I needed to use in a shell I made, and also give to another devloper to use in his shell.  The many peices of my OCX made it difficult to give him the whole thing, so I "stubbed it out."  I gave him an OCX that has all the public properties and methods, but no code.  He compiled it into his shell, and now I neeed to put the real OCX in.  I get the error:

"Failed to load <control> from <ocx>. Your version of <ocx> may be outdated. Make sure you are using the version of the control provided with your application."

On my OCX development computer, I have cleaned the registry of all references to the OCX.  I then copied the stub that I mailed to the other developer and registered it.  In the project, I had the compatibility pointing to the stub.  I am using Binary Compatibility.  I was under the assumption that by having the compatibility version be the stub, it will allow me to "upgrade" without problem, but I still get the error.  I'm hoping I'm just missing something stupid and that one of you geniuses will be able to help.  =)  

~Melissa
0
Comment
Question by:MelissaEvans
  • 5
  • 2
7 Comments
 
LVL 6

Accepted Solution

by:
anthony_glenwright earned 15 total points
ID: 6399563
When you set up binary compatibility, did you store a copy of the OCX for backward-compatibility use, and point to it as the binary compatibility reference in the project properties page?  

I have had this problem before when the binary compatibility radio button is selected, but the path is set to the same file that I compile to.  

If you do point to the same file (which is incorrect), VB will not be able to read the old vtables from the old version to insert into your new version.
0
 

Author Comment

by:MelissaEvans
ID: 6407141
Yes and yes... I put the compatibility OCX where the new one will be compiled to.  I've noticed that VB has a hard time remembering where it was, it defaults back to where you last compiled, so instead of fighting it, I just put the compatibility file there too.  I've saved a version of the file I plan to use as a compatibilty OCX so as to not loose it completely.  
~Melissa
0
 
LVL 6

Expert Comment

by:anthony_glenwright
ID: 6409554
>> I put the compatibility OCX where the new one will be compiled to

This is the problem.  You must NOT point the compatibility OCX/DLL to the same path you compile to.  You have to make a copy of it.

This is because of the order (I think) in which VB does it's compile, which I think (from observation) is:

1.  Delete the old DLL/OCX/whatever
2.  Get the old vtable stuff
3.  Compile the new DLL/OCX/whatever

So, if you are pointing at the same location (for compatibility) as you are compiling to, you will not be binary compatible.  To solve the problem, create a /compat directory somewhere, and copy your OCX into it.  Then point your compatibility path to the version on the /compat directory.

When you are in-between "real" releases, dont update the version in /compat, but each time you make a real release (where you want to maintain backward compatibility), update the /compat version.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 6

Expert Comment

by:anthony_glenwright
ID: 6409556
And, just in case I'm misinterpreting what you are saying, if you have make a copy of the OCX with a different name, but in the same directory, I would recommend what I posted above, but with the same filename (but different directory) - just in case VB has a hard time understanding a different filename.
0
 
LVL 6

Expert Comment

by:anthony_glenwright
ID: 6409590
And, just in case I'm misinterpreting what you are saying, if you have make a copy of the OCX with a different name, but in the same directory, I would recommend what I posted above, but with the same filename (but different directory) - just in case VB has a hard time understanding a different filename.
0
 

Author Comment

by:MelissaEvans
ID: 6423622
It ended up being a licensing issue, but thank you for your time. =)
0
 
LVL 6

Expert Comment

by:anthony_glenwright
ID: 6424210
No problems.  I found a good link that explains versioning quite well the other day, if you are interested:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dn_voices_webservice/html/service08152001.asp?frame=true
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

758 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