Share via


Utility Macros

OverviewHow Do I

WINDOWS.H provides a series of utility macros that are useful for working with the types listed in General Data Types. The utility macros listed in the following table help create and extract data from these types. The FIELDOFFSET macro is particularly useful when you need to give the numeric offset of a structure member as an argument.

Utility Description
MAKELPARAM(low, high) Combines two 16-bit quantities into an LPARAM.
MAKELRESULT(low,high) Combines two 16-bit quantities into an LRESULT.
MAKELP(sel,off) Combines a selector and an offset into a FAR VOID* pointer. Useful only for Windows 3.x.
SELECTOROF(lp) Extracts the selector part of a far pointer. Returns a UINT. Useful only for Windows 3.x.
OFFSETOF(lp) Extracts the offset part of a far pointer. Returns a UINT. Useful only for Windows 3.x.
FIELDOFFSET(type,field) Calculates the offset of a member of a data structure. The type is the type of structure, and field is the name of the structure member or field.