The API macros simplify certain common operations, such as creating a new font, selecting the font into a device context, and saving the handle of the original font. The code looks something like this:
HFONT hFontOrig = (HFONT) SelectObject(hDC, (HGDIOBJ) hFontNew);
This statement requires two casts to get a warning-free compilation. One of the macros in WindowsX.h was designed for exactly this purpose:
#define SelectFont(hdc, hfont) \ ((HFONT) SelectObject( (hdc), (HGDIOBJ) (HFONT) (hfont)))
If you use this macro, the line of code in your program becomes the following:
HFONT hFontOrig = SelectFont(hDC, hFontNew);
This code is easier to read and is much less error-prone.
Several other API macros in WindowsX.h help with common Windows tasks. ...