Error: Unable to cast COM object of type ‘mshtml.HTMLDocumentClass’ to interface type ‘ICustomDoc’

This operation failed because the QueryInterface call on the COM component for the interface with IID ‘{3050F3F0-98B5-11CF-BB82-00AA00BDCE0B}’ failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).

My first reaction was:”What the hell? HTMLDocumentClass is the managed wrapper of MSHTML, and MSHTML is supposed to support the ICustomDoc interface!”

Now I started wondering why the interfaces don’t work I created a sandbox project and tried to cast interface there, but it works smoothly. I played with strong name and found no luck. Finally, I found out that it is the frame document that does not support this interface.

About Sheng Jiang 蒋晟

Microsoft MVP in Visual C , 2004- Forum moderator of the Visual C and .Net forums on CSDN Forum moderator of Chinese forums on Microsoft's MSDN forums
This entry was posted in Microsoft and tagged , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s