GetMonitorInfo

[This is preliminary documentation and subject to change.]

The GetMonitorInfo function lets you obtain information about a display monitor.

BOOL GetMonitorInfo(
  HMONITOR hMonitor,  // handle to display monitor
  LPMONITORINFO lpmi  // pointer to display monitor information 
);
 

Parameters

hmonitor
Handle to the display monitor of interest.
lpmi
Pointer to a MONITORINFO structure or a MONITORINFOEX structure. The function stores information about the specified display monitor in this structure.

You must set the cbSize member of the structure to sizeof(MONITORINFO) or sizeof(MONITORINFOEX) before calling the GetMonitorInfo function. Doing so lets the function determine the type of structure you are passing to it.

The MONITORINFOEX structure is a superset of the MONITORINFO structure. It has one additional member: a string member, to contain a name for the display monitor. Most applications have no use for a display monitor name, and so can save some bytes by using a MONITORINFO structure.

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Windows NT: To get extended error information, call GetLastError. .

QuickInfo

  Windows NT: Requires version 5.0 or later.
  Windows: Requires Windows 98.
  Windows CE: Unsupported.
  Header: Declared in winuser.h.
  Import Library: Use user32.lib.
  Unicode: Implemented as Unicode and ANSI versions on Windows NT.

See Also

Multiple Display Monitors Overview, Multiple Display Monitors Functions, MONITORINFO, MONITORINFOEX