{"id":19413,"date":"2009-01-22T10:00:00","date_gmt":"2009-01-22T10:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2009\/01\/22\/why-do-i-get-the-error-regdb_e_iidnotreg-when-i-call-a-method-that-returns-an-interface\/"},"modified":"2009-01-22T10:00:00","modified_gmt":"2009-01-22T10:00:00","slug":"why-do-i-get-the-error-regdb_e_iidnotreg-when-i-call-a-method-that-returns-an-interface","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20090122-00\/?p=19413","title":{"rendered":"Why do I get the error REGDB_E_IIDNOTREG when I call a method that returns an interface?"},"content":{"rendered":"<p><P>\nThis is another manifestation of the\n<A HREF=\"http:\/\/blogs.msdn.com\/oldnewthing\/archive\/2004\/12\/13\/281910.aspx\">\nmissing marshaller problem<\/A>.\n<\/P>\n<PRE>\nIContextMenu *pcm;\nHRESULT hr = psf-&gt;GetUIObjectOf(hwnd, 1, &amp;pidl,\n               IID_IContextMenu, NULL, &amp;pcm);\n\/\/ fails with REGDB_E_IIDNOTREG\n<\/PRE>\n<P>\nThe <CODE>IContextMenu<\/CODE> interface does not have\na proxy\/stub factory (as of this writing).\nRecall that shell objects, as a rule, are apartment model.\nIf you create the object from a multi-threaded apartment,\nCOM needs to build a wrapper object which can marshal calls\nfrom off-thread back onto the original thread,\nin order to adhere to the threading rules for apartment-model objects.\n<\/P>\n<P>\nAnd if the COM standard marshaler can&#8217;t find a proxy\/stub factory\nfor an interface,\nit returns the error\n<CODE>REGDB_E_IIDNOTREG<\/CODE>.\n<\/P><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is another manifestation of the missing marshaller problem. IContextMenu *pcm; HRESULT hr = psf-&gt;GetUIObjectOf(hwnd, 1, &amp;pidl, IID_IContextMenu, NULL, &amp;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 [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[25],"class_list":["post-19413","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-code"],"acf":[],"blog_post_summary":"<p>This is another manifestation of the missing marshaller problem. IContextMenu *pcm; HRESULT hr = psf-&gt;GetUIObjectOf(hwnd, 1, &amp;pidl, IID_IContextMenu, NULL, &amp;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 [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/19413","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=19413"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/19413\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=19413"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=19413"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=19413"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}