Solved

OCX Compatibility

Posted on 2001-08-17
7
414 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
Macro Excel - Multiple If conditions 2 81
RUNRMTCMD from AS/400 12 68
Error with a code discussed on this page 5 31
Powerpoint 2013: Change cell reference in excel link 3 81
Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
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 Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

856 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