Category: ATL

Active Template Library related

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

How to intercept paste from clipboard into standard EDIT control with ATL and WTL

This sample project features subclassing EDIT control to intercept paste from clipboard and handle it programmatically. The sample fetches text from clipboard, converts it to upper case and replaces control’s selection with this text. There may be more specific handling, such as, for example, recognizing URL being pasted, splitting it into parts and filling multiple…

Read the full article

How to customize OLE property frame window with ATL and WTL

Window API provides useful functions OleCreatePropertyFrame and OleCreatePropertyFrameIndirect, which allow easily to pop up object’s property pages, OLE property pages. The frame, however, is not customizable, does not even allows centering relative to parent’s window. COlePropertyFrameDialogT template class is to be a solution for this problem. Additionally the template offers useful methods to discover available…

Read the full article