Can't use OCX components on x64 - failed to create AxHost

This might be a Visual Studio issue. There are two ways you can compile for 64 bit: x64 as target platform and AnyCPU as target platform. If CVB 64 bit is installed, both variants should do the same, from what I understand.

Applying OCX to a form while the target platform is set to x64 worked fine in the past, for instance with VS 2008 and 2010. Though, the behavior seems to have change in 2015 and 2017.

Also, this is only an issue for OCX components of which VS does not yet have created the local wrappers and references like these ones here:

image

These wrappers and references are created by VS automatically when an OCX is placed on the form for the first time, as far as I know - Something about this behavior seems to have changed.

To sum up: change the target platform to AnyCPU and it all should work fine.

2 Likes