Upgrade existing VB6 COM component

Hi,

I need to change an existing in-process COM DLL used by multiple visual basic applications.  The COM DLL was written in Visual Basic 6 nearly 10 years ago by some consultants and the code was never provided or is no longer available.  The problem is that the code has hard coded values that need to be changed.  

The functionality of the code can easily be reproduced.  So the question is what is the best way to create a replacement component?  It would be ideal not to require that all the existing application be changed or recompiled to use the new component.  

I was thinking of recreating the component in visual basic 6 and setting it to be binary compatible with the existing component.  In that way it should be able to be deployed without affecting existing applications.  But I have a longer term goal to migrate the entire application to .NET and this functionality would need to be migrated at some point.

I briefly looked at the Microsoft website for guidance and saw the recommendation to upgrade using COM interop.  But can that be made binary compatible with the existing component?  

Thanks for you advise and help!
TerryDeanAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

danaseamanCommented:
You should be able to create a new component setting Binary Compatibility against the old DLL.
In order to not break existing Exe or require recompiling do the following:
1. All Public exposed Methods, Properties, Events must be identical to original including Parameter types.
2. ByVal and ByRef for Params must be idnetical to original.
3. You can add Private Functions without problems.

Anything that deviates from above will bump the Major Version number of the component.
Any new Public Methods, Properties, Events will bump the Minor Version numer of the component.

It is easy enough to tell if you are successfull. Just check the new component with OleView or similar to get the TLB Versiuon info.
At top of OleView screen you should see something like this:

// Generated .IDL file (by the OLE/COM Object Viewer)
//
// typelib filename: UniSuiteLite.ocx

[
  uuid(A9E51769-CEC2-4332-85BE-145DF0C9C6A2),
  version(1.0),

If the version is the same as original you should be OK.


0
TerryDeanAuthor Commented:
Thanks for the information!  What about re-writing the component in .NET?  Is it possible to maintain binary compatibility to the original component in .NET?  Thanks again!
0
danaseamanCommented:
Not sure if you could use a Vb6 created OCX as binary compatibility for .Net component.
You could change the GUID of a OCX post-build to match the original though.
See my post "Public Function ReplaceGUIDInFile" at:
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_25001798.html?sfQueryTermInfo=1+10+30+strguidtomemori


0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

TerryDeanAuthor Commented:
I got started attempting to replicate the functionality of the existing com component using VB6 as you suggested.  I figured that I could upgrade to .NET later.  But ran into a couple of problems.  I opened the original TLB in OleView (great suggestion by the way!) which gave me all the functionality I need to replicate.  But there are a couple of properties that I cannot get to replicate in VB6.  The first is "HRESULT _NewEnum([out, retval] IUnknown** retval);"  and the second is "HRESULT Type([out, retval] MTypeConstants* retval);"  VB6 will not let me create a property named _NewEnum or Type.  Is there some way to get VB6 to accept these names or something I can do later to the resulting IDL or TLB to change them?

Thanks again for your help!

0
danaseamanCommented:
What are you enumerating?
For NewEmum is usually something like this for a collection:
You neet to set Procedure ID to -4 via advanced properties.

Public Property Get NewEnum() As IUnknown
   Set NewEnum = mCol.[_NewEnum]
End Property

http://www.bigresource.com/Tracker/Track-vb-JfLxGzuKgs/
http://bytes.com/topic/visual-basic/answers/168907-newenum-diffeculties

Don't know about the Type Property/Method.
Is it possible to upload the Dll? If not direct to this site you can try MediaFire or similar.


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TerryDeanAuthor Commented:
Thanks for your help!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.