32 bit ActiveX Control in a 64 bit .NET App

2020-02-14 11:09发布

I'm creating a C#.Net application which I want to be able to compile for "All CPUs". I also want to include a specific ActiveX control in the UI of this app, but the ActiveX control I'm trying to use does not support 32 bit. Is there some trick or work around I can use to use get this control to work?

What about embedding the ActiveX control in a Web-browser control? Would this even work?

2条回答
戒情不戒烟
2楼-- · 2020-02-14 11:11

You can't load 32 bit components in a 64 bit application, but you can wrap the component in its own process and use IPC to leverage the features of the component. Of course this may not be feasible depending on the actual component.

查看更多
我欲成王,谁敢阻挡
3楼-- · 2020-02-14 11:21

You have to run the ActiveX control in a separate 32-bit process. That's going to be difficult, it would have its own window that isn't going to be part of the UI of your 64-bit process. Although it is expressly forbidden by the SDK docs, you can try to take advantage of the Windows 3 appcompat built into the SetParent() API function. It might work.

You'll have lots of additional trouble, communicating between processes is tricky enough (you'll need Remoting or WCF), the hard part is dealing with exceptions. One process bombing with the other one surviving and never noticing that something is wrong is not going to be pretty.

Perhaps the Platform Target option starts sounding attractive?

查看更多
登录 后发表回答