How to print function names to debug output with ATL’s ATLTRACE macro

Starting Visual Studio .NET version 2003 (2002?) ATL offered new tracing macros ATLTRACE/ATLTRACE2 which are quite convenient and flexible to generate debug output and, what is important, come with ATL debug API which allows to adjust output settings on runtime using ATL/MFC Trace Tool.

The problem however appeared to be that ATL debug API does not seem to support printing function names, although trace tools shows checbox “Category & Function Names”. I am solving this shortage.

Continue reading →

Automated Resource Updater updated (1.0.3)

What’s new in this build?

  • Fixed: Dialog template update would fail on an attempt to set DS_FIXEDSYS or DS_SETFONT flags if none were previously set, as well as unset both flags if any of them were presiously set; This is required because dialog template structre has optional fields defining font which has to be added/removed with the style change
  • New: Dialog.ItemStyle property provides access to dialog template control’s styles, for instance, to set/unset WS_VISIBLE style

Continue reading →

Extending life of Correct Identity Mozilla addon for Mozilla Thunderbird

Correct Identity is a beautiful addon for Mozilla Thunderbird, the major problem is that Dennis Verspuij has not been having time or desire to keep it up to date and the goody became incompatible with the email client starting version 1.5.

To extend addon’s life a bit it is possible to adjust compatibility information so that the same addon, as it is, could be recognized by Thunderbird version 1.5.

To do this, it is required to locate addon’s RDF file, I have it in:

$(SystemDrive):\Documents and Settings\$(UserName)\Application Data\Thunderbird\Profiles\$(ProfileName)\extensions\{47ef7cc0-2201-11da-8cd6-0800200c9a66}\install.rdf

This is a text file in XML format, openable by text editor, it contains text:

< RDF:Description RDF:about="rdf:#$dZX88"
em:id=”{3550f703-e582-4d05-9a08-453d09bdfdc6}”
em:minVersion=”1.0″
em:maxVersion=”1.4″ / >

which needs to e replaced with, for example:

< RDF:Description RDF:about="rdf:#$dZX88"
em:id=”{3550f703-e582-4d05-9a08-453d09bdfdc6}”
em:minVersion=”1.0″
em:original-maxVersion=”1.4″
em:maxVersion=”1.5″
/ >

and after Thunderbird 1.5 restart it will recognize and start the addon. It seems the addon works with Thunderbird 1.5, no problems so far.

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) to each item. This is quite sufficient when using controls, however type cast to and from DWORD_PTR is required with most control item data operations.

CAiComboBoxT and CAiListViewT classes templates redefine GetItemData/SetItemData methods to perform automatic type casts. An optional template class CAiListControlDataTraitsT does even more: it manages per-item definted item data class in contained CAtlList collection and attached a pointer to item data class to each control item.

The classes may be used as follows:

CAiComboBoxT < CComboBoxItemData* > m_ComboBox;
CAiListViewT < CListViewItemData, CAiListControlDataTraitsT > m_ListView;

m_ComboBox is a combo box window class (CComboBox descendant) with CComboBoxItemData pointer defined as control item data.

m_ListView is a list view class (CListViewCtrl descendant) with CListViewItemData defined as control item data. CListViewItemData instances are managed by control class using CAtlList collection (and a position in the collection is actually casted to DWORD_PTR and set as lower level control item data).

20-image001.png

Continue reading →

Automated Resource Updater updated (1.0.2)

An update is inspired by necessity to strip DS_FIXEDSYS dialog style which Visual Studio adds to the dialog template once it is modified in resource editor.
What’s new in this build?

  • Fixed: Failure accessing STRINGTABLE values with identifiers such that ((IDS & 0x0F) == 0x0F)
  • New: Unicode build
  • New: Static link to C runtime, smaller binary and download
  • New: Dialogs property and accessor to resource dialog templates, dialogs collection exposes enumerator and individual resource accessor of type Dialog. Dialog object has a read/write Style property

Continue reading →

CAutoHideScrollBarsEdit: a multiline edit control which shows and hides scroll bars automatically in ATL and WTL

The idea is not new, to say the least, the interested ones may check this topic at codeguru.com. This sample demonstrate a most simple (and straightforward) method how to do the task and is basically a demo for a simple custom control, which is based on existing control.

17-image001.png

Continue reading →