How to add features to standard message boxes in ATL and WTL

MessageBox function is easy to use but it sometimes lacks features. They can be added through a hook, however. This sample demonstrates three features for message boxes:

  1. AtlMessageBoxEx shows message box centered by parent window
  2. AtlTimedMessageBoxEx shows message box with countdown timer to close
  3. AtlOptionalMessageBoxEx shows message box with checkbox to suppress the box in future (the setting is stored into registry)

AtlTimedMessageBoxEx:

image202.png

AtlOptionalMessageBoxEx:

image203.png

Visual C++.NET 2003 source code can be downloaded here, compiled binary – here.

UPDATE 2021-Feb-13: The code is re-published as a github repository: roman380/AdvancedMessageBoxes01: How to add features to standard message boxes in ATL and WTL (github.com)

Leave a Reply