Showing posts with label wtl8. Show all posts
Showing posts with label wtl8. Show all posts

Tuesday, May 21, 2013

What is 'CPoint' : ambiguous symbol atltypes.h?

It was a dark and rainy night.. I was trying to do something useful.. what I don't remember right now.. But I was getting this weird problem...

Error 1 error C2872: 'CPoint' : ambiguous symbol atltypes.h
Error 2 error C2872: 'CRect' : ambiguous symbol atltypes.h
Error 3 error C2872: 'CSize' : ambiguous symbol atltypes.h
.
.
Error N error C2872: 'CReality' : ambiguous symbol life.h

Obviously (is it?) I was using ATL and WTL to do something... After scratching my head, googling and going through few WTL headers .. I found the solution. Just include the following, just after you add the #include <windows.h> :
#include <atlbase.h>

#if (_ATL_VER >= 0x0700)
#include <atlstr.h>
#include <atltypes.h>
#endif

#if (_ATL_VER >= 0x0700)
#define _WTL_NO_CSTRING
#define _WTL_NO_WTYPES
#define _WTL_NO_UNION_CLASSES
#endif

#include <atlapp.h>

Sunday, May 12, 2013

WTL::CRichEditCtrl

WTL::CRichEditCtrl needs the following line for initialization, add it in your DllMain or _tWinMain and it resolves the issue:
HINSTANCE hInstRich = ::LoadLibrary(CRichEditCtrl::GetLibraryName());
Unfortunately I forgot that Rich Edit isn’t a common control and is not initialized with InitCommonControlsEx.

Monday, September 24, 2012

How to hide a window from Win32 Taskbar?


Argh !!! I don't know why but I keep forgetting the ex-style bit for this... 
To prevent the window button from being placed on the taskbar, create the unowned window with the WS_EX_TOOLWINDOW extended style. As an alternative, you can create a hidden window and make this hidden window the owner of your visible window.
The Shell will remove a window's button from the taskbar only if the window's style supports visible taskbar buttons. If you want to dynamically change a window's style to one that doesn't support visible taskbar buttons, you must hide the window first (by calling ShowWindow with SW_HIDE), change the window style, and then show the window.
Taken from here: The Taskbar

Tuesday, June 5, 2012

Atlapp and secure atl !!

After upgrading to VS2008, I started getting errors for lstrlenA, size_t, and lstrcpynA. My "include directories" settings are exactly the same as my old VS2005, and if I open the project in VS2005, everything compiles just fine. So what is the fix for this problem??

And the fix is really simple, before including atlapp.h, just define:
 
#define _SECURE_ATL 1