64bit Compatible ActiveX-DLL with VB.NET, C#, Any CPU

> Edraw Tip > 64bit Compatible ActiveX-DLL with VB.NET, C#, Any CPU
author
Posted by Allison Lynch |
The 32 and 64-bit Edraw office viewer ActiveX controls use the exact same interfaces and the exact same GUID's. This means that you need not 2 interops for the vb.net or c# project, but only one.

When running the .net application (any CPU option) in a 64-bit environment, it will immediately pick up the 64-bit ActiveX because it will be accessing the system registry view for 64-bit, which is pointing to the 64-bit dll in the key

HKCR\Software\Classes\CLSID\{7677E74E-5831-4C9E-A2DD-9B1EF9DF2DB4}\InProcServer32.

Note: the Edraw Viewer Component for Word has the different GUID:569EB2D6-161D-4AE0-9804-640E724A297A; the Edraw Viewer Component for Excel has the different GUID:367AD645-0381-4750-9B15-741067C2A118

The following article will demo how to embed the office viewer component in C# application with Any CPU compile option step by step.

Register the 64 Bit Office Viewer Component

If you haven't the component, you need to install the package firstly.

By default, the setup program regsvr32 the 32 bit officeviewer.ocx file in the target computer. To use it at 64 bit project, you need regsvr32 the 64 bit officeviewer.ocx file manually.

In the install folder, you can find the x64 redist folder.

x64 redist

There is a reg.bat file in it.

reg.bat 64 office

You can use the text edit tool to open it. Then modify the component path.

change path

Right click the reg.bat file then click the Run as Administrator menu item.

reg64ocx success

The bat file will regsvr32 the 64 bit officeviewer.ocx file and EDOfficeViewerX.dll in the target computer.

To check whether the computer register the 32/64 bit office viewer component, follow the steps:

1. 64bit: Verify the COM object is registered under HKCR\Software\Classes\CLSID\7677E74E-5831-4C9E-A2DD-9B1EF9DF2DB4, Interfaces and TypeLib
2. 32bit: Verify the COM object is registered under HKCR\Software\WOW6432Node\Classes\CLSID\7677E74E-5831-4C9E-A2DD-9B1EF9DF2DB4, Interfaces and TypeLib

Create a New c# Windows Form Application

In the Toolbox panel, click the Choose Items...

In the pop up dialog, choose the Edraw Office Viewer Component.

x86 office viewer

NOTE: Visual Studio is still a 32-bit development environment. The Edraw component will automatically place the 32-bit versions of the ActiveX in the toolbox. Since the components share the same interface and the same GUID, you can use all the ease of the Visual Studio development environment and still have all the power of 64-bit under the hood.

Drag the component into the form as normal. Change the Platform Target as Any CPU. Rebuild All.

To distribute the project, you can register both ActiveX and ActiveX64 on the target machine. The application automatically switch if you are on a 32 or 64-bit machine. If your application will only run on 64-bit machines, you can set the application to target x64, and only distribute the ActiveX64.

Embedding MS Office in ASP.NET Program

Embed MS Office in 64bit IE

Embedding MS Project

Embedding Visio

An Easy Way to Embed Excel in a Web Page

Embedded MS PowerPoint

Disables MS Word Standard Command

Disable Office Ribbon Button

Show/Hide Office Menu Bar

download EdrawMind
main page

Get Started! You Will Love This Easy-To-Use Diagram Software

EdrawMax is an advanced all-in-one diagramming tool for creating professional flowcharts, org charts, mind maps, network diagrams, UML diagrams, floor plans, electrical diagrams, science illustrations, and more. Just try it, you will love it!