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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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 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!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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.
--
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)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
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:
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?
Hi,
I am afraid there isnt one I am aware of :( ...
Best regards,
Vikram
On Oct 24, 2013 8:47 AM, "monica nath" monicacnath@users.sf.net wrote:
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!
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
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)
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
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:
--
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)