Super Message

TaskDialogIndirect unter Win9x/ME/XP

SuperMessage is a wrapperfunction for TaskDialogIndirect that also works under Windows 9x/XP

Installation

  1. Add SuperMessage.cpp and SuperMessage.h from the download to your project
  2. Include SuperMessage.h in every file where you want to use the function
  3. Now compile the project. Everywhere you use TaskDialog or TaskDialogIndirect already a warning is displayed. Change the name to SuperMessageW. (If you forget to remove one direct call to TaskDialog(Indirect), your program is going to fail starting under Win9x/XP)
  4. [Optional] If not happened already you should call InitCommonControls() at startup, include commctrl.h and link to comctl32.lib, because the progressbar won't work properly otherwise. It's advised to add a manifest as well, in order to enable the new style of Windows XP.
  5. That's it!

Features

  • SuperMessage directs the call under Vista directly to the original function and builds an own dialog otherwise
  • It supports (almost) all features TaskDialog has: commandbuttons, radiobuttons, a checkbox, hyperlinks, progressbars, footer, userdefined icons and much more.
  • It works under all today used Windows versions: 95, 98, ME, NT, 2000, XP and even Mobile 5 (PDA/Pocket PC/Smartphone)
  • In addition there is a ansi version of the function (SuperMessageA). (Both work on Win 9x)
  • Very easy way to include in your application. There are no dlls/libs and no dependencies to other APIs (except WinAPI of course)
  • You don't have to install the new Vista SDK with the TaskDialog definition

Differences between SuperMessage and TaskDialog

SuperMessage displays the dialog like Win9x users expect it. For example it aligns the buttons centered, instead of right like in Vista (if there are no commandbuttons). In addition the background is grey, instead of white-grey mixed like the TaskDialog under Vista.

Functions

In the header are three functions declared:

  • SuperMessageW replaces TaskDialog and TaskDialogIndirect (overload)
  • SuperMessageA expects all strings in ansi, converts them to unicode and calls SuperMessageW. You just have to note that you have to use different structs:
    • TASKDIALOGCONFIG - SUPERMESSAGECONFIGA
    • .
    • TASKDIALOG_BUTTON - SUPERMESSAGE_BUTTONA
    You can remove the A and W in all functions and structs in order to keep your project compilable for Ansi and Unicode
  • IsTaskDialogOriginal tells you whether the original TaskDialog function is availabe

Restrictions

  • TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE has no effect (guess why...)
  • TDM_NAVIGATE_PAGE, TDM_SET_MARQUEE_PROGRESS_BAR and TDM_SET_PROGRESS_BAR_STATE aren't implemented yet
  • The calculation of the clientwidth is not perfect yet, but it should be enough
  • Under Windows Mobile the default icons (error, warning...) don't work, because LoadIcon doesn't support them

License

You can use this code in all projects you want to, as long as the comment in the beginning isn't changed. If you completed a project with SuperMessage, you extended the code or you found a bug, please let me know.

download

Included are SuperMessage.cpp/.h, this website and an example with source and binary