Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
An application-defined callback function used with the EnumDisplayMonitors function. The MONITORENUMPROC type defines a pointer to this callback function. MonitorEnumProc is a placeholder for the application-defined function name.
Syntax
MONITORENUMPROC Monitorenumproc;
BOOL Monitorenumproc(
HMONITOR unnamedParam1,
HDC unnamedParam2,
LPRECT unnamedParam3,
LPARAM unnamedParam4
)
{...}
Parameters
unnamedParam1
Type: HMONITOR
A handle to the display monitor. This value will always be non-NULL. This parameter is typically named hMonitor.
unnamedParam2
Type: HDC
A handle to a device context. This parameter is typically named hdcMonitor.
The device context has color attributes that are appropriate for the display monitor identified by hMonitor. The clipping area of the device context is set to the intersection of the visible region of the device context identified by the hdc parameter of EnumDisplayMonitors, the rectangle pointed to by the lprcClip parameter of EnumDisplayMonitors, and the display monitor rectangle.
This value is NULL if the hdc parameter of EnumDisplayMonitors was NULL.
unnamedParam3
Type: LPRECT
A pointer to a RECT structure. This parameter is typically named lprcMonitor.
If hdcMonitor is non-NULL, this rectangle is the intersection of the clipping area of the device context identified by hdcMonitor and the display monitor rectangle. The rectangle coordinates are device-context coordinates.
If hdcMonitor is NULL, this rectangle is the display monitor rectangle. The rectangle coordinates are virtual-screen coordinates.
unnamedParam4
Type: LPARAM
Application-defined data that EnumDisplayMonitors passes directly to the enumeration function. This parameter is typically named dwData.
Return value
Type: BOOL
To continue the enumeration, return TRUE.
To stop the enumeration, return FALSE.
Remarks
Note
The parameters are defined in the header with no names: typedef BOOL (CALLBACK* MONITORENUMPROC)(HMONITOR, HDC, LPRECT, LPARAM);. Therefore, the syntax block lists them as unnamedParam1 - unnamedParam4. You can name these parameters anything in your app. However, they are usually named as shown in the parameter descriptions.
You can use the EnumDisplayMonitors function to enumerate the set of display monitors that intersect the visible region of a specified device context and, optionally, a clipping rectangle. To do this, set the hdc parameter to a non-NULL value, and set the lprcClip parameter as needed.
You can also use the EnumDisplayMonitors function to enumerate one or more of the display monitors on the desktop, without supplying a device context. To do this, set the hdc parameter of EnumDisplayMonitors to NULL and set the lprcClip parameter as needed.
In all cases, EnumDisplayMonitors calls a specified MonitorEnumProc function once for each display monitor in the calculated enumeration set. The MonitorEnumProc function always receives a handle to the display monitor.
If the hdc parameter of EnumDisplayMonitors is non-NULL, the MonitorEnumProc function also receives a handle to a device context whose color format is appropriate for the display monitor. You can then paint into the device context in a manner that is optimal for the display monitor.
Requirements
| Requirement | Value |
|---|---|
| Minimum supported client | Windows 2000 Professional [desktop apps only] |
| Minimum supported server | Windows 2000 Server [desktop apps only] |
| Target Platform | Windows |
| Header | winuser.h (include Windows.h) |