Menu

Enumerate Type Library information for non automated COM libraries

2013-10-24
2013-10-31
  • monica nath

    monica nath - 2013-10-24

    Hi,

    I have a COM library that does not support automation - it inherits from IUnknown. And I wanted to get all it's structures and enumerations at run time since we could potentially add many more interfaces to it later.

    However, since it does not use IDispatch, I cannot use IJITypeInfo and IJITypeLib. I also cannot use tlbinf32.dll since it is not a redistributable that we can ship (I think it is no longer supported as well?).

    Any other suggestions on what I can use to get all structures and enum's from my COM library at run time? Has anyone written a TLB parser in java? Or has anyone used oleaut32.dll for this?

    Thanks,
    Monica

     
    • Vikram Roopchand

      Hi,

      I am not sure if it is possible without ITypeInfo (or Type library
      interfaces).

      Best regards,
      Vikram
      On Oct 24, 2013 8:17 AM, "monica nath" monicacnath@users.sf.net wrote:

      Hi,

      I have a COM library that does not support automation - it inherits from
      IUnknown. And I wanted to get all it's structures and enumerations at run
      time since we could potentially add many more interfaces to it later.

      However, since it does not use IDispatch, I cannot use IJITypeInfo and
      IJITypeLib. I also cannot use tlbinf32.dll since it is not a
      redistributable that we can ship (I think it is no longer supported as
      well?).

      Any other suggestions on what I can use to get all structures and enum's
      from my COM library at run time? Has anyone written a TLB parser in java?
      Or has anyone used oleaut32.dll for this?

      Thanks,
      Monica


      Enumerate Type Library information for non automated COM librarieshttps://sourceforge.net/p/j-interop/discussion/600729/thread/cffc63df/?limit=25#bc62

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/j-interop/discussion/600729/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       
  • monica nath

    monica nath - 2013-10-24

    Thanks for quick response, Vikram!
    And ITypeInfo and ITypeLib require the COM library to support automation, right?

    Both my libraries return false for isDispatchSupported.

    Can you suggest any way to write a TLB parser?

     
  • monica nath

    monica nath - 2013-10-29

    Thanks for your response, Vikram! After a lot of investigation, I managed to figure out a workaround - i added a new interface into the same com class that uses IDisptachImpl. This allowed the dispatch support to be true when I query that interface and then using that interface, I can query all structures and enums for the com class.

    I am using your examples MSTypeLibraryBrowser2.java and MSTypeLibraryBrowser.java - however I am not able to get the type of elements in the structure. like for example, I have a structure A which has a short variable called id and a pointer to a structure called type. This is what I get using the example in MSTypeLibraryBrowser2.java:

    ***Variable Seperator**
    0: DispID = 1073741824
    VarName = id
    VarKind = 0
    ***Variable Seperator**
    1: DispID = 1073741825
    VarName = type
    VarKind = 0
    How do I get the correct variable kind? Plus where is the enum for all var kinds. In the code I see //TODO convert to string representation. How do I do that? I want to use reflection and then create everything on the fly. Thanks!

     
    • Vikram Roopchand

      Hi Monica,

      Please have a look at this
      http://msdn.microsoft.com/en-us/library/ms897140.aspx .

      In the code I see //TODO convert to string representation. How do I do

      that? I want to use reflection and then create everything on the fly.

      Yes, we kind of left that mid-way :) ... I guess you will have to get the
      right representation by getting the VarType and work your way up from there.

      best regards,
      Vikram

      --
      The Mind is a place of its own. It can make a heaven out of hell or a hell
      out of heaven. Attitude is everything. No matter how adverse conditions
      maybe, one has the capacity to turn things around by one's Determination,
      Perseverance and Hardwork.

      John Milton
      (Paradise Lost)

       
  • monica nath

    monica nath - 2013-10-30

    Thanks Vikram! It is great how you respond to all posts!

    I am able to use VarType now.

    How do I figure out structures though? So, when vt=29, it says it is user defined and then HREFTYPE is 400. Now how do I use this 400 to figure out the structure/enum it is refering to.

    Thanks,
    Monica

     
    • Vikram Roopchand

      Hi,

      It will just point you out to "a" struct and its upto you to figure out
      which struct it is ... you will have to use the remaining interfaces/flags
      of the ITypeLib interface.

      best regards,
      Vikram

      On Thu, Oct 31, 2013 at 1:05 AM, monica nath monicacnath@users.sf.netwrote:

      Thanks Vikram! It is great how you respond to all posts!

      I am able to use VarType now.

      How do I figure out structures though? So, when vt=29, it says it is user
      defined and then HREFTYPE is 400. Now how do I use this 400 to figure out
      the structure/enum it is refering to.

      Thanks,
      Monica


      Enumerate Type Library information for non automated COM librarieshttps://sourceforge.net/p/j-interop/discussion/600729/thread/cffc63df/?limit=25#bc23

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/j-interop/discussion/600729/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

      --
      The Mind is a place of its own. It can make a heaven out of hell or a hell
      out of heaven. Attitude is everything. No matter how adverse conditions
      maybe, one has the capacity to turn things around by one's Determination,
      Perseverance and Hardwork.

      John Milton
      (Paradise Lost)

       

Log in to post a comment.