32 bit ActiveX Control in a 64 bit .NET App
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?
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?
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.
精彩评论