This is another manifestation of the missing marshaller problem.
IContextMenu *pcm; HRESULT hr = psf->GetUIObjectOf(hwnd, 1, &pidl, IID_IContextMenu, NULL, &pcm); // fails with REGDB_E_IIDNOTREG
The IContextMenu
interface does not have
a proxy/stub factory (as of this writing).
Recall that shell objects, as a rule, are apartment model.
If you create the object from a multi-threaded apartment,
COM needs to build a wrapper object which can marshal calls
from off-thread back onto the original thread,
in order to adhere to the threading rules for apartment-model objects.
And if the COM standard marshaler can’t find a proxy/stub factory
for an interface,
it returns the error
REGDB_E_IIDNOTREG
.
0 comments