Class monikers are monikers that represent an object class. Class monikers bind to the class object of the class for which they are created.
Class monikers are most useful in composition with other types of monikers, such as file monikers or item monikers. Class monikers may also be composed to the right of monikers supporting binding to the IClassActivator interface. This allows IClassActivator to provide access to the class object and instances of the class.
To use class monikers, you must use the CreateClassMoniker function to create the monikers.
If pmkLeft is non-NULL, calls pmkLeft->BindToObject for IClassActivator and calls IClassActivator::GetClassObject with the CLSID it was initialized with and the CLSCTX and LOCALE parameters from of the current pbc (IBindContext).
This process is very roughly sketched out in the following code:
BIND_OPTS2 bindOpts;
IClassActivator *pActivate;
bindOpts.cbStruct = sizeof(bindOpts);
pbc->GetBindOptions(&bindOpts);
if (NULL == pmkToLeft)
return CoGetClassObject(<clsid>, bindOpts.dwClassContext, NULL, riid, ppvResult);
pmkToLeft->BindToObject(pbc, NULL, IID_IClassActivator, (void **) &pActivate);
hr = pActivate->GetClassObject(<clsid>, bindOpts.dwClassContext, bindOpts.locale, iid, ppvResult);
pActivate->Release();
return hr;
display-name = "CLSID:" string-clsid-no-curly-braces *[";" clsid-options] ":"
clsid-options = clsid-param "=" value
clsid-param = none currently defined
Example:
clsid:a7b90590-36fd-11cf-857d-00aa006d2ea4:
hr = BindToObject(pbc, pmkToLeft, IID_IParseDisplayName, (void**)&ppdn);
if (SUCCEEDED(hr)) {
hr = ppdn->ParseDisplayName(pbc, lpszDisplayName, pchEaten, ppmkOut);
ppdn->Release();
}
return hr;
This method tries to acquire an IParseDisplayName pointer, first by binding to the class factory for the object identified by the moniker, and then by binding to the object itself. If either of these binding operations is successful, the file moniker passes the unparsed portion of the display name to the IParseDisplayName::ParseDisplayName method.
This method returns MK_E_SYNTAX if pmkToLeft is non-NULL.