27 July 2009

Building and running ActiveX Control Test Container on x64

I'm currently running Windows 7 x64 Ultimate RC* on my notebook, and I needed to build an ActiveX control for a prototype at work.

Using ATL and the wizards in Visual Studio 2008 to generate the initial control took about a minute, but then I realized I didn't have the ActiveX Control Test Container in the list of external tools in my tools menu.

I searched my system for tstcon*.* but found nothing.

After a brief search, I turned up a thread at Channel 9 discussing this very issue, and it turns out the source for the ActiveX Control Test Container is in a zip file.

On my system, the zip file is

C:\Program Files (x86)\Microsoft Visual Studio 9.0\Samples\1033\AllVCLanguageSamples.zip

and the source for the ActiveX Control Test Container is in

C++\MFC\ole\TstCon

inside the Zip file.

I extracted and built the code (Release x64) but the application wouldn't run, failing with a SideBySide error in the Application log in Event Viewer.

A further search turned up a solution: disable the Enable User Account Control (UAC) linker flag for both the support DLL and the application.

I updated the thread at Channel 9 with this information as well.

I'm going to experiment a little bit and see if I can run both 32- and 64-bit versions of controls in 32- and 64-bit containers, respectively: I may need to do a little reading up on WoW64 to see what the issues are.

* 10 days to RTM!