64位Vista中调用32位ActiveX问题

ActiveX Controls – Attempting to run an application built under Windows Vista 64-bit editions results in runtime exception

SYMPTOMS

Attempting to run an application built under Windows Vista 64-bit editions results in runtime exception:

System.Runtime.InteropServices.COMException was unhandled

  Message=”Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))”

  Source=”System.Windows.Forms”

  ErrorCode=-2147221164

  StackTrace:

    …

    stack trace

    …

The application will build successfully, but will throw an exception at runtime.

CAUSE

ActiveX Controls are 32-bit technology.

RESOLUTION

Applications using ActiveX Control must be built for 32-bit targets.

1. Open the ‘Properties’ page for your project.

2. Select the ‘Build’ tab.

3. In the ‘General’ section, click the ‘Platform Target’ dropdown list down arrow.

4. Select ‘x86’.

5. Close the ‘Properties’ page.

6. Rebuild the application.

By Lu Jun

80后男,就职于软件行业。习于F*** GFW。人生48%时间陪同电子设备和互联网,美剧迷,高清视频狂热者,游戏菜鸟,长期谷粉,临时果粉,略知摄影。

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.