2 out of 2 rated this helpful - Rate this topic

GetMonitorInfo function

Applies to: desktop apps only

The GetMonitorInfo function retrieves information about a display monitor.

Syntax

BOOL GetMonitorInfo(
  __in   HMONITOR hMonitor,
  __out  LPMONITORINFO lpmi
);

Parameters

hMonitor [in]

A handle to the display monitor of interest.

lpmi [out]

A pointer to a MONITORINFO or MONITORINFOEX structure that receives information about the specified display monitor.

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 that contains 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 value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Examples

For an example, see Positioning Objects on a Multiple Display Setup.

Requirements

Minimum supported client

Windows 2000 Professional

Minimum supported server

Windows 2000 Server

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

Unicode and ANSI names

GetMonitorInfoW (Unicode) and GetMonitorInfoA (ANSI)

See also

Multiple Display Monitors Overview
Multiple Display Monitors Functions
MONITORINFO
MONITORINFOEX

 

 

Send comments about this topic to Microsoft

Build date: 3/7/2012

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ