如何在 64 位操作系统中注册 activeX 组件(.dll) [英] how to register the activeX component(.dll) in 64 bit OS

查看:31
本文介绍了如何在 64 位操作系统中注册 activeX 组件(.dll)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用用户控件创建了 ActiveX 控件 (.dll) &注册为 COM 组件.它在 32 位操作系统中运行良好.但是当在 64 位操作系统(窗口服务器 2008)中注册相同的 activeX 控件时,它会抛出以下异常

i create the ActiveX control(.dll) using user control & register as COM component . it working fine in 32 bit OS . but when register the same activeX control in 64 bit os (window server 2008) it throws following exception

Could not load file or assembly 'file :////C:Program FilesSTPLGlobActiveX.dll' or one of its dependencies. an attempt was made to load a program with an incorrect format. 

我使用以下代码注册了dll组件

i have used the following code to register the dll component

filepath=C:Program Files STPLGlobActiveX.dll
            Assembly asm = Assembly.LoadFrom(filePath);
            RegistrationServices regAsm = new RegistrationServices();
            bool bResult = regAsm.RegisterAssembly(asm, AssemblyRegistrationFlags.SetCodeBase);

如何在 64 位操作系统中注册 activeX 组件(.dll)?

how to register the activeX component(.dll) in 64 bit OS?

我想在 64 位程序文件中安装这个 activeX.我已经将我的 winform 应用程序安装为 64 位设置.即这个设置将安装在 64 位平台上.因为我在加载 activeX 时使用了一个 path.gcon 文件来处理我的应用程序,然后它从注册表 HKEY_LOCAL_MACHINESOFTWAREAPPLICATION_NAMELOCATION 中我的应用程序安装路径中获取数据库路径,然后从该位置读取 path.gcon 文件然后启动activeX控件

i want to installed this activeX in 64 bit program files.I have install my winform application as setup 64 bit.i.e this setup will be installed in 64 bit platform . because i have used the one path.gcon file to working with my application when my activeX loaded then it take databse path from the my application installation path from the registry HKEY_LOCAL_MACHINESOFTWAREAPPLICATION_NAMELOCATION then from this location read the path.gcon file then start the activeX control

当我将activeX注册为x86平台时,它注册成功&存储到 HKEY_CLASSES_ROOTwow6432Node.js 中.path.gcon 无法在 ActiveX 控件中读取.x64平台如何注册ActiveX控件?

when i have register the activeX as x86 platform then it register successfully & stored into the HKEY_CLASSES_ROOTwow6432Node. path.gcon can not read in activeX control. How to register the ActiveX control in x64 platform?

推荐答案

你的 dll 是 32 位的,所以 exe 必须在 32 位模式下运行.在 64 位 Windows 中,带有 Platform AnyCPU 的 .NET exe 以 64 位模式运行.在 32 位 Windows 中,带有 Platform AnyCPU 的 .NET exe 以 32 位模式运行.我觉得你主机的exe是Platform AnyCPU,重新编译到Platform x86,或使用 CorFlags.exe 更改 exe,强制开启 32 位标志.

Your dll is 32-bit, so exe must run in 32-bit mode. In 64-bit Windows, .NET exe with Platform AnyCPU runs in 64-bit mode. In 32-bit Windows, .NET exe with Platform AnyCPU runs in 32-bit mode. I think you host exe is Platform AnyCPU, recompile it to Platform x86, or use CorFlags.exe to change the exe, force 32-bit flag on.

这篇关于如何在 64 位操作系统中注册 activeX 组件(.dll)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆