Home > Technology, VB6 > VB6 Binary Compatibility

VB6 Binary Compatibility

This is another reprint of an article I originally wrote on VBForums. In it I show how to set Binary Compatibility on your VB6 component libraries (this works for OCXes as well as DLLs of the ActiveX variety).

Enjoy!

Watch very carefully and this will/may be the last time you have to do it.

  1. Open the dll project.
  2. Open the properties dialog for the project.
  3. Select the Component tab (if there’s a set of options regarding the Compatibility at the bottom, you have the right one)
  4. Make sure that “No Compatibility” is selected. Click OK
  5. From the File Menu, select MAke xyzMyDll.Dll
  6. In the Save As File dialoge, make a new directory (I’m assuming that this is going into the same folder where the project is.) Doesn’t matter what you call it. We call our “Release” but you cna give it any name you want.
  7. Compile the DLL into that new directory.
  8. When done, open the Project properties form again and back to the Component tab.
  9. This time select “Binary Compatibility” There should be a button right there that will allow you to select the file to be compatible with. Click it.
  10. Select the DLL you JUST created.
  11. Close all screens and compile the DLL again. THIS TIME compile it back to the PROJECT folder.
  12. Save the project file.

From now on, when ever you make a change, you can simply replace the DLL w/o needing to reset the reference every time.

At this point, you will need to reset the reference in the other projects one last time (because we compiled it once at the begining with no compatibility) but after that, it will stick.

— NOTE This will work as long as the interface (public subs, functions, object, etc) don’t change (doesn’t include the code inthose elements, but their external physical signature.) If the interface does change, then repeat steps 5 -12, but using a new folder (in our case we end up with Release, Release 2, Release 3, etc).

What this does: By setting the compatibility, the same classID will be generated for the DLL each time. When you set “No Compatibility” a new ClassID is created everytime. This is why you have to reset the reference after compiling. Since it will always have the same classId now, projects will be able to maintain the reference correctly.

Advertisements
Categories: Technology, VB6
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: