Archive

Archive for the ‘ActiveX’ Category

Where is TstCon: ActiveX test container

September 19, 2013 Leave a comment

Long back we used to have an ActiveX test container called TstCon, which was used for debugging our ActiveX controls.

I went looking for the container and found TstCon in the samples folder, Ideally it will be the following sample folder…

root\AllVCLanguageSamples\C++\MFC\ole\TstCon

More of why TstCon was moved out of the standard tools that ships with Visual Studio is explained here…

http://blogs.msdn.com/b/vcblog/archive/2010/03/18/activex-test-container-application-is-still-available.aspx

In VS2008 and VS2010 the samples will be found in the sample folder under
VsInstallDir\Samples\1033\

GetDlgItem fails for an ActiveX control

September 6, 2013 Leave a comment

Was working with a customer yesterday who was having this issue of GetDlgItem failing to return a valid window handle for an ActiveX control placed on a dialog. The ActiveX control is visible though but curiously the handle was always showing up as NULL.

While debugging saw this particular line in the Visual Studio 2010 output window…

image

Hmm interesting. Why is the control saying I want to be windowless. Customer never mentioned he wants a windowless control.

So when creating an ActiveX control the wizard provides a checkbox which says the following…

image

When the above checkbox is checked the wizard adds the following line of code into your ActiveX control’s constructor…

image

In my customer’s case this was the reason for GetDlgItem not returning a valid window object for the ActiveX control.

Another way this problem can manifest is when you turn off m_bWindowOnly in your activex control class. This variable will be off if you are creating a windowless control.

In short I would say: always keep an eye on the visual studio output window. 🙂