Hosting PreviewHandlers on x64 gives REGDB_E_CLASS

2019-08-06 03:31发布

问题:

So this is the case, I am using the http://www.codeplex.com/C4FDevKit, I want to use the PreviewHandlerHost control in my desktop application I successfully been able to do it and test it on XP 32, 64 bits and Vista 32, 64 bits

the issue only appeared on XP x64, This is the exception message

Unable to cast COM object of type 'System.__________ComObject' interface type 'MyApplication.IPreviewHandler'. This failed because the QueryInterface call on the COM component for the interface with IID '{8895B1C6-B41F-4C1C-A562-0D564250836F}' failed due to the following error: class not registered (Exception from HRESULT: 0x80040154 (REGDB_______E___CLASSNOTREG)).

Please any help is appreciated. And the file I was trying to preview was a Microsoft Word Document.

回答1:

Go into the Project Properties for your desktop application, click the "Compile" tab and click "Advanced Compile Options...". Change "Target CPU" to x86, click OK, save, recompile and try again.

I've just hit this one myself - see COMException "Class not registered" on 64-bit Windows for more info.



标签: com interop