网站首页  词典首页

请输入您要查询的函数:

 

术语 enumdisplaymonitors
释义 EnumDisplayMonitors
语法:
BOOL EnumDisplayMonitors(
__in HDC hdc,
__in LPCRECT lprcClip,
__in MONITORENUMPROC lpfnEnum,
__in LPARAM dwData
);
EnumDisplayMonitors功能
枚举函数的EnumDisplayMonitors包括无形的伪显示器(监视器与镜像驱动程序有关)相交由指定剪辑矩形交汇点,具有一个设备上下文的可见区域形成一个区域。 EnumDisplayMonitors调用一个应用程序定义的每个枚举监测MonitorEnumProc回调函数一次。请注意,GetSystemMetrics(SM_CMONITORS)只算的显示器。
参数
hdc [in]
一个句柄,显示设备情况下,界定有关的可见区域。
如果该参数为NULL,hdcMonitor参数传递给回调函数将是NULL,而利息可见区域是虚拟屏幕,包括桌面上的所有的显示器。
lprcClip [in]
一个RECT结构,指定剪辑矩形指针。感兴趣区域是由hdc指定的可见区域剪辑矩形的交集。
如果hdc是非空,该剪辑矩形坐标是相对于为HDC的起源。如果hdc是NULL,则坐标虚拟屏幕坐标。
此参数可以为NULL,如果您不想剪辑hdc指定的地区。
lpfnEnum [in]
一个 MonitorEnumProc应用指针定义的回调函数。
dwData [in]
应用程序定义的数据EnumDisplayMonitors通过直接MonitorEnumProc功能。
返回值
如果函数成功,返回值为非零。
如果函数失败,返回值是零。
备注
原因有两个调用EnumDisplayMonitors功能:
要绘制到设备上下文优化跨越多个显示器和监视器有不同的颜色格式。
您想获得一个句柄和一个或多个显示器的位置矩形。
要确定是否所有显示在监控系统共享相同的颜色格式,调用GetSystemMetrics(SM_SAMEDISPLAYFORMAT)。
您不需要使用EnumDisplayMonitors函数时,一个窗口跨越显示器具有不同颜色的格式。您可以继续画的前提就是整个屏幕具有主监视器的颜色属性。您的Windows的外观罚款。 EnumDisplayMonitors只是让您把它们看起来更好。
对HDC参数设置为NULL,您可以使用EnumDisplayMonitors函数获取句柄和一个或多个显示器的位置矩形。下表显示了如何为NULL和非四个结合,空HDC和lprcClip价值观影响EnumDisplayMonitors函数的行为。
hdclprcRectEnumDisplayMonitors行为
NULLNULLEnumerates所有显示器。
回调函数接收一个NULL HDC。
NULLnon - NULLEnumerates所有显示器剪辑相交的矩形。使用虚拟屏幕坐标为剪辑矩形。
接收回调函数一个NULL HDC。
非NULLNULLEnumerates所有显示器的相交的设备上下文的可见区域。
回调函数接收处理特定显示屏到DC。
非NULLnon - NULLEnumerates所有显示器的相交的设备上下文的可见区域和剪辑矩形。使用设备上下文坐标为剪辑矩形。
回调函数接收处理特定显示屏到DC。
实例
画在响应WM_PAINT消息,利用每个监视器的功能,您可以使用像这样在一个窗口过程代码:
案件WM_PAINT消息:
hdc =调用BeginPaint(的HWND,和PS);
EnumDisplayMonitors(探知,空,MyPaintEnumProc,0);
EndPaint(的HWND,和PS);
画使用的每一个监视器的功能窗口上半部分,您可以使用这样的代码:
GetClientRect(的HWND,与区局);
rc.bottom =(rc.bottom - rc.top)/ 2;
hdc = GetDC(hwnd);
EnumDisplayMonitors(探知,与区局,MyPaintEnumProc,0);
ReleaseDC(的HWND,HDC)的;
画为每个显示屏整个虚拟屏幕优化,可以使用如下代码:
hdc = GetDC(空);
EnumDisplayMonitors(探知,空,MyPaintScreenEnumProc,0);
ReleaseDC(空,HDC公司);
检索有关的显示器,使用这样的代码的所有资料:
EnumDisplayMonitors(空,空,MyInfoEnumProc,0);
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinuser.h(头文件:winuser.h)
LibraryUser32.lib
DLLUser32.dll
参见
多显示监视器概述
多显示监视器功能
MonitorEnumProc
GetSystemMetrics
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==EnumDisplayMonitors Function
The EnumDisplayMonitors function enumerates display monitors (including invisible pseudo-monitors associated with the mirroring drivers) that intersect a region formed by the intersection of a specified clipping rectangle and the visible region of a device context. EnumDisplayMonitors calls an application-defined MonitorEnumProc callback function once for each monitor that is enumerated. Note that GetSystemMetrics (SM_CMONITORS) counts only the display monitors.
Syntax
BOOL EnumDisplayMonitors(
__in HDC hdc,
__in LPCRECT lprcClip,
__in MONITORENUMPROC lpfnEnum,
__in LPARAM dwData
);
Parameters
hdc [in]
A handle to a display device context that defines the visible region of interest.
If this parameter is NULL, the hdcMonitor parameter passed to the callback function will be NULL, and the visible region of interest is the virtual screen that encompasses all the displays on the desktop.
lprcClip [in]
A pointer to a RECT structure that specifies a clipping rectangle. The region of interest is the intersection of the clipping rectangle with the visible region specified by hdc.
If hdc is non-NULL, the coordinates of the clipping rectangle are relative to the origin of the hdc. If hdc is NULL, the coordinates are virtual-screen coordinates.
This parameter can be NULL if you don't want to clip the region specified by hdc.
lpfnEnum [in]
A pointer to a MonitorEnumProc application-defined callback function.
dwData [in]
Application-defined data that EnumDisplayMonitors passes directly to the MonitorEnumProc function.
Return Value
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero.
Remarks
There are two reasons to call the EnumDisplayMonitors function:
You want to draw optimally into a device context that spans several display monitors, and the monitors have different color formats.
You want to obtain a handle and position rectangle for one or more display monitors.
To determine whether all the display monitors in a system share the same color format, call GetSystemMetrics (SM_SAMEDISPLAYFORMAT).
You do not need to use the EnumDisplayMonitors function when a window spans display monitors that have different color formats. You can continue to paint under the assumption that the entire screen has the color properties of the primary monitor. Your windows will look fine. EnumDisplayMonitors just lets you make them look better.
Setting the hdc parameter to NULL lets you use the EnumDisplayMonitors function to obtain a handle and position rectangle for one or more display monitors. The following table shows how the four combinations of NULL and non-NULL hdc and lprcClip values affect the behavior of the EnumDisplayMonitors function.
hdclprcRectEnumDisplayMonitors behavior
NULLNULLEnumerates all display monitors.
The callback function receives a NULL HDC.
NULLnon-NULLEnumerates all display monitors that intersect the clipping rectangle. Use virtual screen coordinates for the clipping rectangle.
The callback function receives a NULL HDC.
non-NULLNULLEnumerates all display monitors that intersect the visible region of the device context.
The callback function receives a handle to a DC for the specific display monitor.
non-NULLnon-NULLEnumerates all display monitors that intersect the visible region of the device context and the clipping rectangle. Use device context coordinates for the clipping rectangle.
The callback function receives a handle to a DC for the specific display monitor.

Examples
To paint in response to a WM_PAINT message, using the capabilities of each monitor, you can use code like this in a window procedure:

case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
EnumDisplayMonitors(hdc, NULL, MyPaintEnumProc, 0);
EndPaint(hwnd, &ps);
To paint the top half of a window using the capabilities of each monitor, you can use code like this:

GetClientRect(hwnd, &rc);
rc.bottom = (rc.bottom - rc.top) / 2;
hdc = GetDC(hwnd);
EnumDisplayMonitors(hdc, &rc, MyPaintEnumProc, 0);
ReleaseDC(hwnd, hdc);
To paint the entire virtual screen optimally for each display monitor, you can use code like this:

hdc = GetDC(NULL);
EnumDisplayMonitors(hdc, NULL, MyPaintScreenEnumProc, 0);
ReleaseDC(NULL, hdc);
To retrieve information about all of the display monitors, use code like this:

EnumDisplayMonitors(NULL, NULL, MyInfoEnumProc, 0);
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinuser.h (include Windows.h)
LibraryUser32.lib
DLLUser32.dll
See Also
Multiple Display Monitors Overview
Multiple Display Monitors Functions
MonitorEnumProc
GetSystemMetrics
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd162610(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:16:25