Solved

OCX Compatibility

Posted on 2001-08-17
7
419 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
[X]
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
  • 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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…

734 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