Re: getting GUID from dispatches
"Aldo T. Kurnia" <[email protected]> Tue, 6 Feb 2007 15:56:00 -0800
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <[email protected]> |
Hi Paul, Thanks for your help. I'll try that solution right away.=20 I'm trying to create a "bridge" so I can use the dll functions from java. The problem was, when I create FuncPtr by specifying the dll file, jawin couldn't see most of the functions, so I had to go through the registry to access those functions. The stub constructor from the typebrowser works great, except for the fact that the GUIDs are hard-coded, so when they change, the whole solution would fall apart. That's why I'm trying to get those GUIDs dynamically. Aldo -----Original Message----- From: Discussion of Java/Win32/COM integration with Jawin [mailto:[email protected]] On Behalf Of Paul Schauble Sent: Tuesday, February 06, 2007 12:40 PM To: [email protected] Subject: Re: [JAWIN] getting GUID from dispatches You need a JNI dll to do it. I do not know if one already exists. I'm curious, why do you need to GUID for the IDispatch interface. I've been working intensively with COM for several years and I've never needed to know that in the client. ++PLS -----Original Message----- From: Discussion of Java/Win32/COM integration with Jawin [mailto:[email protected]] On Behalf Of Aldo T. Kurnia Sent: Monday, February 05, 2007 5:12 PM To: [email protected] 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.=20 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.=20 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.