3.11 Utility Macros and Functions

Utility macros and functions return contents of words and bytes, create unsigned long integers and structures, and perform specialized arithmetic. Following are the utility macros and functions:

Function or macro Description

HIBYTE Returns the high-order byte of an integer.
HIWORD Returns the high-order word of a long integer.
LOBYTE Returns the low-order byte of an integer.
LOWORD Returns the low-order word of a long integer.
MAKEINTATOM Casts an integer for use as a function argument.
MAKEINTRESOURCE Converts an integer value into a long pointer to a string, with the high-order word of the long pointer set to zero.
MAKELONG Creates an unsigned long integer.
MAKEPOINT Converts a long value that contains the x- and y-coordinates of a point into a POINT structure.
MulDiv Multiplies two word-length values and then divides the result by a third word-length value, returning the result rounded to the nearest integer.
PALETTEINDEX Converts an integer into a palette-index COLORREF value.
PALETTERGB Converts values for red, green, and blue into a palette-relative RGB COLORREF value.
RGB Converts values for red, green, and blue into an explicit RGB COLORREF value.