Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9038795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T09:34:27+00:00 2026-06-16T09:34:27+00:00

I have a Delphi 6 app that uses an ActiveX DLL to interface to

  • 0

I have a Delphi 6 app that uses an ActiveX DLL to interface to another popular app (aka the “host” app for lack of a better word). The host app provides the integration DLL. I do not have the source code for it or any control over it. To use the DLL I create a TypeLib using the IDE Import ActiveX Control facility.

The problem arises when the host app vendor creates a new version of the ActiveX DLL. I have to scramble and provide my users with a new version of my program as they upgrade to the host app vendor’s latest or beta versions. Otherwise my app crashes of course when certain calls are made to the integration DLL due to variances between the old TypeLib and the new DLL. This also leads to the burden of maintaining multiple code bases of my app to maintain support for my users that still use the old versions of the host app. I’m trying to avoid a big messy code overhaul where I wrap everything in sight exposed by the integration DLL, in order to create a version of my code that can adapt at run-time to the current DLL version.

That leads to my question. The TypeLib(s) generated by Delphi is a big list of IDispatch methods and properties. Apparently the Delphi compiler converts these to IDispatch.Invoke() calls behind the scenes. Now I can detect the current version of the host app before I call CoCreate() to create the ActiveX object. So, is there any way I can at run-time switch between the two DLL TypeLib definitions? Right now I do it via compile-time conditionals that include the correct TypeLib based on the version of the host app I’m building for. I can do this because I retain each version of the TypeLib and give it a unique name as the vendor updates the DLL. But that doesn’t help me to do it at run-time.

I can’t fathom how to do this because everything from defined variables to method calls is based on the TypeLib as it is compiled. But I was wondering if there is something clever I could do at the IDispatch level to make this happen? Otherwise I’m stuck creating wrappers for each exposed object that calls the correct TypeLib method/property definition based on the current version of the host app. This is a big job and will also lead to some pretty convoluted code.

How have those of you faced with this same predicament solved or coped with it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T09:34:28+00:00Added an answer on June 16, 2026 at 9:34 am

    The practical solution would be to use late binding (getting a reference using CreateOleObject and having the references resolved at runtime) instead of using early binding via the typelibs. This would mean that as long as the vendor doesn’t remove functionality, your code would continue to work regardless of what version of the control was installed.

    For examples of doing this with MS Office applications, you can see several of the old (but still accurate and usable) posts at Deborah Pate’s site (see note below). For instance, this one for Word uses late binding to either retrieve the currently running Word instance or create a new one:

    var 
      Word: Variant; 
      Filename: OleVariant;
    begin 
      try 
        Word := GetActiveOleObject('Word.Application');    
      except 
        Word := CreateOleObject('Word.Application');    
      end; 
    
      FileName := 'C:\WordDocs\MyFile.doc';
      Word.Documents.Open(FileName, EmptyParam, EmptyParam, EmptyParam,
                          EmptyParam, EmptyParam, EmptyParam, EmptyParam,
                          EmptyParam, EmptyParam);  
      Word.Visible := True;
    

    Note that there is no included type library here, and no prior declaration of Word.Documents or the Documents.Open method. These are both resolved for you at runtime, and if not implemented will raise an exception.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

my delphi 2009 app uses a DLL that performs some activities that may take
I have a delphi application that uses BTMemoryModule and imports/calls functions from a DLL.
I have a Delphi + SQL Server (2k or 2005 supported) app that is
I have a Delphi 6 application that uses the Indy 9 components to maintain
My computer crashed recently. We have a Delphi app that takes a lot of
I have a Delphi 2006 app that pops up a modal alert dialog when
I have a Delphi app where I display a list of games that have
I have this problem for days now. I have a delphi app that i
I have a Delphi 2006 app that I am adding code to process some
Brief Description of the app: I have written a Delphi application that allows a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.