OleRegGetUserType (ole32)
Last changed: anonymous

.
Summary

C# Signature:

[DllImport("ole32.dll")]
static extern int OleRegGetUserType([In] ref Guid clsid, uint dwFormOfType,
   [Out, MarshalAs(UnmanagedType.LPWStr)] StringBuilder pszUserType);

User-Defined Types:

None.

Notes:

The above C# signature didn't work for me. Instead, I used:

  [DllImport("ole32.dll")]
  static extern int OleRegGetUserType([In] ref Guid clsid, uint dwFormOfType, out IntPtr pszBuff);

and then marhalled the Unicode string pointer to a managed string. See the sample code below.

Tips & Tricks:

Please add some!

Sample Code:

    Guid clsid = new Guid(0x3e6b91f5, 0xbc86, 0x40b8, 0x80, 0xc9, 0x41, 0xb3, 0x4b, 0x4e, 0x8f, 0x11);
    IntPtr pszBuf;
    int nResult = OleRegGetUserType(ref clsid, (uint)USERCLASSTYPE.USERCLASSTYPE_FULL, out pszBuf);
    string strClass = Marshal.PtrToStringUni(pszBuf);

Alternative Managed API:

Do you know one? Please contribute it!

Documentation