Re: getting GUID from dispatches
Paul Schauble <[email protected]> Tue, 6 Feb 2007 12:33:41 -0800
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <0165EECEBB4CF745ACF095E1176B03EA0D6163D6@SUNCA-EXB-AV1.ticketmaster.corp> |
__uuid only works when you have the header file for the class in scope
and the class has an __declspec that defines the GUID. It's a compile
time thing, not a run time evaluation.
As for LoadTypeLib, this is C++ so I'll leave you to figure out how to
transpose it to java:
ITypeLib *pTypeLib;
HRESULT hr =3D LoadTypeLib(filename, &pTypeLib);
Then study the ITypeLib interface is MSDN to see how to extract
information from the type library.
++PLS
-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Normand Mongeau
Sent: Monday, February 05, 2007 10:13 PM
To: [email protected]
Subject: Re: [JAWIN] getting GUID from dispatches
we use __uuid() to get GUIDs, as in
__uuid(yourDispatchClass)
Normand
----- Original Message -----
From: "Aldo T. Kurnia" <[email protected]>
To: <[email protected]>
Sent: Monday, February 05, 2007 7:11 PM
Subject: Re: [JAWIN] getting GUID from dispatches
Thanks for your reply! I'm new to this "COM world" and still confused
with your suggestion. Let's just say I have a dll called "abc.dll". It
has a CoClass called "abc", and a Dispatch called "_abc", and I want to
get the GUID of the dispatch "_abc" from a java program.
I assume you're referring to the LoadTypeLib from win32 api. How exactly
can I call the LoadTypeLib? Are you suggesting that I create a new
function to extract the GUID in a new dll file and then calling that new
dll from my java program?
Is there any way to do this directly from Java?
Fyi, I'm not allowed to modify anything in abc.dll
Thanks.
Aldo
-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Paul Schauble
Sent: Monday, February 05, 2007 3:33 PM
To: [email protected]
Subject: Re: [JAWIN] getting GUID from dispatches
I'm not a Java guru, but I do understand COM.
There are 2 usual ways to do this.
First is to call LoadTypeLib passing the name of the exe of dll file.
This returns an ITypeInfo interface for the type library contained in
the executable.
The second is to create one of the coclasses and call
IDispatch::GetTypeInfo. This returns a point to an ITypeInfo interface
that contains the relevant type library.
In either case, you can use the ITypeInfo interface to read the type
library and get the information you need.
++PLS
-----Original Message-----
From: Discussion of Java/Win32/COM integration with Jawin
[mailto:[email protected]] On Behalf Of Aldo Kurnia
Sent: Monday, February 05, 2007 3:58 PM
To: [email protected]
Subject: [JAWIN] getting GUID from dispatches
Hi,
I have been trying to get the GUIDs from a dll file so I don't have
hard-code it in jawin's auto-generated java files (which will break when
the
GUID changes, and it will change).
I'm able to do this for the co-classes by reading the registry value in
HKEY_CLASSES_ROOT/<function_name>, but dispatches are stored in the
HKEY_CLASSES_ROOT/Interfaces/<{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxxx}>
subkeys, and in my case, there are 3-4 keys with the same value
(probably
from previous versions of the dll), and it's impossible to determine
which
one the correct key.
Is there a way to get the GUIDs for the dispatches without going through
the
registry and without using ProgID?
I also haven't been able to determine how jawin was able to get the
GUIDs in
the first place.
Any suggestion would be greatly appreciated.
Thank you.