views:

65

answers:

2
+4  Q: 

COM Interface Guid

Hello, I'm not much into COM interfaces, so i have a small question, say I have this code:

[Guid("148BD528-A2AB-11CE-B11F-00AA00530503"), 
 InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
internal interface IEnumWorkItems {
    [PreserveSig()]
    int Next([In] uint RequestCount, [Out] out System.IntPtr Names, 
                       [Out] out uint Fetched);
    void Skip([In] uint Count);
    void Reset();
    void Clone([Out, MarshalAs(UnmanagedType.Interface)] 
                          out IEnumWorkItems EnumWorkItems);
}

How do I know that "148BD528-A2AB-11CE-B11F-00AA00530503" corresponds to IEnumWorkItems : http://msdn.microsoft.com/en-us/library/aa380706(VS.85).aspx

Like if I want to know this interface's GUID : http://msdn.microsoft.com/en-us/library/aa381811(VS.85).aspx where do I find it?

+3  A: 

I've never encountered a formal documentation - there are, however, several ways to look it up:

  • Open the type lib (usually the server DLL itself) in OLE Viewer (included in visual studio tools)
  • looking it up in the SDK .idl's / .h's
  • write short VC++ program and use __uuidof(IInterface)
  • Looking it up under HKCR\Interface (though not all interfaces need to get registered there)
peterchen
Yes, the SDK. MSTask.idl declares them.
Hans Passant
+2  A: 

In the registry, do a search for the class name in HKEY_CLASSES_ROOT, you will find the GUID

Alexander