Month: January 2007

Smart ATL/WTL combo box and list view classes to cast and optionally manage typed control item data

Inspired by the post on Yahoo’s WTL group (actually, I have been going to post on this topic for a couple of weeks already). Standard Windows controls (including common controls) that have multiple items (list box, combo box, list view, tree view etc.) have an option to attach user defined value of type DWORD_PTR (LPARAM)…

Read the full article

How to obtain call stack programmatically in ATL and WTL (actually, ATL only)

While debugging, obtaining call stack at a certain [problematic] point of execution, such as especially deadlock condition or on assert, is an invaluable help. Debugger shows it, however it is possible to get the call stack programmatically and even more: having program database along with the executable it is even possible to resolve symbols and…

Read the full article

WTL style notification message cracking macros for common control notifications

Windows Template Library contains atlcrack.h header file with macros to reinterpret window message parameters: split if required and cast to proper type. For instance, instead of: MESSAGE_HANDLER_EX(WM_SIZE, OnSize) … LRESULT OnSize(UINT, WPARAM wParam, LPARAM lParam) { UINT nType = (UINT) wParam; CSize Extent(LOWORD(lParam), HIWORD(lParam)); it allows to make things simpler and in a more reliable…

Read the full article

Regular Expression bug in Visual Studio 2005

I already encountered similar issue once before but did not write down the details. Text: #define TBN_GETBUTTONINFO (TBN_FIRST-0) #define TBN_BEGINDRAG (TBN_FIRST-1) #define TBN_ENDDRAG (TBN_FIRST-2) #define TBN_BEGINADJUST (TBN_FIRST-3) #define TBN_ENDADJUST (TBN_FIRST-4) #define TBN_RESET (TBN_FIRST-5) #define TBN_QUERYINSERT (TBN_FIRST-6) #define TBN_QUERYDELETE (TBN_FIRST-7) #define TBN_TOOLBARCHANGE (TBN_FIRST-8) #define TBN_CUSTHELP (TBN_FIRST-9) Find What (using regular expressions): ^\#define:b+({([A-z\_])+}):b+.+$ Replace With: #define MSG_\1(nIdentifier,…

Read the full article