Desktop Functions:

   Smart Device Functions:

Show Recent Changes
Subscribe (RSS)
Misc. Pages
Helpful Tools
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
createclassmoniker (ole32)

C# Signature:

static extern int CreateClassMoniker([In] ref Guid rclsid,
   out IMoniker ppmk);


[DllImport("Ole32.dll", PreserveSig = false)]
static extern IMoniker CreateClassMoniker([In, MarshalAs(UnmanagedType.LPStruct)]Guid guid);

User-Defined Types:



The ref modifier or the [MarshalAs(LPStruct)] attribute are required on the guid parameter; otherwise it is marshaled incorrectly and the call will fail with an access violation.

The managed definition for the IMoniker interface is available in System.Runtime.InteropServices.ComTypes

The Windows API documentation states that this function automatically calls AddRef on the resulting instance before returning. The .Net framework seems aware of this at some level, as the object is freed correctly with a single call to Marshal.ReleaseComObject()

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:

Do you know one? Please contribute it!


Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

Access directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version