GetDlgItem fails for an ActiveX control

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 […]
Continue reading…

 

ATL 9.0 displayed in the middle of an Activex control

Recently a customer of mine faced this issue. So he had an ActiveX control and when displaying the ActiveX control in browser a string is displayed right in the middle of the control: “ATL 9.0”. So this issue happens because you didn’t override CComControlBase::OnDraw  function. The default code for CComControlBase::OnDraw looks like the following… [sourcecode language=”cpp”]HRESULT CComControlBase::YourClassName::OnDraw(_In_ ATL_DRAWINFO& […]
Continue reading…

 

Set resource handle in MFC and ATL

When working in MFC/ATL and then using a resource dll can at times cause bugs because resource handle is not properly set. For e.g. if you have a dialog resource in a dll and you instantiate a CDialog which results in an error because resource cannot be located in this application or dll since it’s in […]
Continue reading…

 

How to convert ANSI string to UNICODE string and vice versa?

Well quite simple,  but still quite frequently asked in forums… 🙂 There are two macros that does this for us. They are as follows. Note: You must include atlconv.h A2W – ANSI to UNICODE W2A – UNICODE to ANSI Before using these two macros you have to use this macro too… USES_CONVERSION Here is a […]
Continue reading…