网站首页  词典首页

请输入您要查询的函数:

 

术语 changedisplaysettingsex
释义 ChangeDisplaySettingsEx
语法:
LONG ChangeDisplaySettingsEx(
__in LPCTSTR lpszDeviceName,
__in DEVMODE *lpDevMode,
HWND hwnd,
__in DWORD dwflags,
__in LPVOID lParam
);
ChangeDisplaySettingsEx功能
该ChangeDisplaySettingsEx功能改变指定的显示设备的设置,以指定图形模式。
参数
lpszDeviceName [in]
一个指向 null 结尾的字符串指针,指定显示设备的图形模式将发生变化。只显示由EnumDisplayDevices返回的设备名称是有效的。见EnumDisplayDevices就这些显示设备有关的名称的进一步资料。
该lpszDeviceName参数可以为NULL。 NULL值指定默认的显示设备。默认的设备,都可以由调用EnumDisplayDevices和DISPLAY_DEVICE_PRIMARY_DEVICE标志检查。
lpDevMode [in]
一个DEVMODE结构,描述了新的图形模式的指针。如果lpDevMode为NULL,所有目前在该注册表值将被用于显示设置。通过为lpDevMode参数和dwFlags参数0 NULL是最简单的方法后返回一个动态模式更改为默认模式。
该dmSize成员必须初始化的大小,以字节为单位的DEVMODE结构。该dmDriverExtra成员必须初始化,以指示司机的私人数据的字节数后DEVMODE结构。此外,您可以使用DEVMODE结构下面的任何成员。
MemberMeaning
dmBitsPerPelBits每像素
dmPelsWidthPixel宽度
dmPelsHeightPixel高度
dmDisplayFlagsMode旗
dmDisplayFrequencyMode频率
dmPositionPosition在多设备的显示器配置。
除了利用一个或多个成员的DEVMODE前,您还必须设置一个或多个成员的dmFields下面的值来改变显示设置。
ValueMeaning
DM_BITSPERPELUse的dmBitsPerPel价值。
DM_PELSWIDTHUse的dmPelsWidth价值。
DM_PELSHEIGHTUse的dmPelsHeight价值。
DM_DISPLAYFLAGSUse的dmDisplayFlags价值。
DM_DISPLAYFREQUENCYUse的dmDisplayFrequency价值。
DM_POSITIONUse的dmPosition价值。
hwnd
版权所有;必须为NULL。
dwflags [in]
指示如何图形模式应该改变。此参数可以是下列值之一。
ValueMeaning
0The图形当前屏幕模式将被动态改变。
CDS_FULLSCREENThe模式是临时性的。
如果您更改并从另一个桌面,这种模式将不会重设。
CDS_GLOBALThe设定将保存在该地区的全局设置,使他们会影响计算机上的所有用户。否则只为用户设置被修改。此标志时才有效CDS_UPDATEREGISTRY并且与标志指定。
CDS_NORESETThe设置将被保存在注册表中,但不会生效。此标志时才有效CDS_UPDATEREGISTRY并且与标志指定。
CDS_RESETThe设置应该改变的,即使要求设置与当前设置相同。
CDS_SET_PRIMARYThis设备将成为主要的设备。
CDS_TESTThe系统如果被请求的图形模式可以设置的测试。
CDS_UPDATEREGISTRYThe图形当前屏幕模式将被动态地改变图形模式将在注册表更新。该模式的信息存储在用户配置文件。
CDS_VIDEOPARAMETERSWhen设置,lParam参数是一个指向VIDEOPARAMETERS结构的指针。
指定CDS_TEST允许应用程序,以确定哪些图形模式真正有效,而不会导致系统改变他们。
如果指定了CDS_UPDATEREGISTRY并且有可能改变图形模式动态,信息存储在注册表中和返回DISP_CHANGE_SUCCESSFUL。如果无法改变图形模式动态,信息存储在注册表中和返回DISP_CHANGE_RESTART。
如果指定了CDS_UPDATEREGISTRY并且信息不能存储在注册表中的图形模式不改变,DISP_CHANGE_NOTUPDATED返回。
lparam的 [in]
如果dwFlags是CDS_VIDEOPARAMETERS,lParam是一个指向VIDEOPARAMETERS结构的指针。否则lparam的必须是NULL。
返回值
该ChangeDisplaySettingsEx函数返回下列值之一。
ValueMeaning
DISP_CHANGE_SUCCESSFULThe设置更改是成功的。
DISP_CHANGE_BADDUALVIEWThe设置的改变是不成功的,因为系统是双屏幕显示功能的能力。
DISP_CHANGE_BADFLAGSAn标志的设置是无效的传入
DISP_CHANGE_BADMODEThe图形模式不支持。
DISP_CHANGE_BADPARAMAn无效的参数传递进来,这可以包括一个无效的旗帜或标志的组合。
DISP_CHANGE_FAILEDThe显示驱动程序未能指定图形模式。
DISP_CHANGE_NOTUPDATEDUnable设置写入注册表。
DISP_CHANGE_RESTARTThe必须重新启动计算机的图形模式工作。
备注
为确保DEVMODE结构传递给ChangeDisplaySettingsEx是有效的,只包含值的显示驱动程序的支持,使用由EnumDisplaySettings函数返回的DEVMODE的。
当添加一个显示屏到一个多监视器系统编程,设置DEVMODE.dmFields为DM_POSITION并指定位置(在DEVMODE.dmPosition)为监视器您补充说,邻近至少有一个现有显示器领域像素监视器。为了分离监测,设置DEVMODE.dmFields为DM_POSITION但设置DEVMODE.dmPelsWidth和DEVMODE.dmPelsHeight为零。有关更多信息,请参阅多显示器。
当显示模式动态改变的WM_DISPLAYCHANGE消息被发送到所有正在运行的以下信息参数应用。
ParametersMeaning
位每像素wParamNew
LOWORD(lparam的)新像素宽度
HIWORD(lparam的)新像素高度
要更改多个同时显示,单独为每个设备更新不应用更改的注册表第一次调用ChangeDisplaySettingsEx的设置。然后调用ChangeDisplaySettingsEx再次,与空装置,以应用更改。例如,要改变两个显示器的设置,执行下列操作:
ChangeDisplaySettingsEx(lpszDeviceName1,lpDevMode1,空,(CDS_UPDATEREGISTRY并且| CDS_NORESET),空);
ChangeDisplaySettingsEx(lpszDeviceName2,lpDevMode2,空,(CDS_UPDATEREGISTRY并且| CDS_NORESET),空);
ChangeDisplaySettingsEx(空,空,空,0,空);
要求:
最低支持:client-Windows 2000专业版
最低支持server-Windows 2000服务器
HeaderWinuser.h(头文件:winuser.h)
LibraryUser32.lib
DLLUser32.dll
Unicode和ANSI namesChangeDisplaySettingsExW(Unicode)和ChangeDisplaySettingsExA(ANSI)的
参见
设备上下文概述
设备上下文函数
CreateDC
的DEVMODE
EnumDisplayDevices
EnumDisplaySettings
VIDEOPARAMETERS
WM_DISPLAYCHANGE
如果有任何问题和意见,请发送给微软(wsddocfb@microsoft.com)
生成日期:2009年7月11日
==英文原文==ChangeDisplaySettingsEx Function
The ChangeDisplaySettingsEx function changes the settings of the specified display device to the specified graphics mode.
Syntax
LONG ChangeDisplaySettingsEx(
__in LPCTSTR lpszDeviceName,
__in DEVMODE *lpDevMode,
HWND hwnd,
__in DWORD dwflags,
__in LPVOID lParam
);
Parameters
lpszDeviceName [in]
A pointer to a null-terminated string that specifies the display device whose graphics mode will change. Only display device names as returned by EnumDisplayDevices are valid. See EnumDisplayDevices for further information on the names associated with these display devices.
The lpszDeviceName parameter can be NULL. A NULL value specifies the default display device. The default device can be determined by calling EnumDisplayDevices and checking for the DISPLAY_DEVICE_PRIMARY_DEVICE flag.
lpDevMode [in]
A pointer to a DEVMODE structure that describes the new graphics mode. If lpDevMode is NULL, all the values currently in the registry will be used for the display setting. Passing NULL for the lpDevMode parameter and 0 for the dwFlags parameter is the easiest way to return to the default mode after a dynamic mode change.
The dmSize member must be initialized to the size, in bytes, of the DEVMODE structure. The dmDriverExtra member must be initialized to indicate the number of bytes of private driver data following the DEVMODE structure. In addition, you can use any of the following members of the DEVMODE structure.
MemberMeaning
dmBitsPerPelBits per pixel
dmPelsWidthPixel width
dmPelsHeightPixel height
dmDisplayFlagsMode flags
dmDisplayFrequencyMode frequency
dmPositionPosition of the device in a multi-monitor configuration.

In addition to using one or more of the preceding DEVMODE members, you must also set one or more of the following values in the dmFields member to change the display settings.
ValueMeaning
DM_BITSPERPELUse the dmBitsPerPel value.
DM_PELSWIDTHUse the dmPelsWidth value.
DM_PELSHEIGHTUse the dmPelsHeight value.
DM_DISPLAYFLAGSUse the dmDisplayFlags value.
DM_DISPLAYFREQUENCYUse the dmDisplayFrequency value.
DM_POSITIONUse the dmPosition value.

hwnd
Reserved; must be NULL.
dwflags [in]
Indicates how the graphics mode should be changed. This parameter can be one of the following values.
ValueMeaning
0The graphics mode for the current screen will be changed dynamically.
CDS_FULLSCREENThe mode is temporary in nature.
If you change to and from another desktop, this mode will not be reset.
CDS_GLOBALThe settings will be saved in the global settings area so that they will affect all users on the machine. Otherwise, only the settings for the user are modified. This flag is only valid when specified with the CDS_UPDATEREGISTRY flag.
CDS_NORESETThe settings will be saved in the registry, but will not take effect. This flag is only valid when specified with the CDS_UPDATEREGISTRY flag.
CDS_RESETThe settings should be changed, even if the requested settings are the same as the current settings.
CDS_SET_PRIMARYThis device will become the primary device.
CDS_TESTThe system tests if the requested graphics mode could be set.
CDS_UPDATEREGISTRYThe graphics mode for the current screen will be changed dynamically and the graphics mode will be updated in the registry. The mode information is stored in the USER profile.
CDS_VIDEOPARAMETERSWhen set, the lParam parameter is a pointer to a VIDEOPARAMETERS structure.

Specifying CDS_TEST allows an application to determine which graphics modes are actually valid, without causing the system to change to them.
If CDS_UPDATEREGISTRY is specified and it is possible to change the graphics mode dynamically, the information is stored in the registry and DISP_CHANGE_SUCCESSFUL is returned. If it is not possible to change the graphics mode dynamically, the information is stored in the registry and DISP_CHANGE_RESTART is returned.
If CDS_UPDATEREGISTRY is specified and the information could not be stored in the registry, the graphics mode is not changed and DISP_CHANGE_NOTUPDATED is returned.
lParam [in]
If dwFlags is CDS_VIDEOPARAMETERS, lParam is a pointer to a VIDEOPARAMETERS structure. Otherwise lParam must be NULL.
Return Value
The ChangeDisplaySettingsEx function returns one of the following values.
ValueMeaning
DISP_CHANGE_SUCCESSFULThe settings change was successful.
DISP_CHANGE_BADDUALVIEWThe settings change was unsuccessful because the system is DualView capable.
DISP_CHANGE_BADFLAGSAn invalid set of flags was passed in.
DISP_CHANGE_BADMODEThe graphics mode is not supported.
DISP_CHANGE_BADPARAMAn invalid parameter was passed in. This can include an invalid flag or combination of flags.
DISP_CHANGE_FAILEDThe display driver failed the specified graphics mode.
DISP_CHANGE_NOTUPDATEDUnable to write settings to the registry.
DISP_CHANGE_RESTARTThe computer must be restarted for the graphics mode to work.

Remarks
To ensure that the DEVMODE structure passed to ChangeDisplaySettingsEx is valid and contains only values supported by the display driver, use the DEVMODE returned by the EnumDisplaySettings function.
When adding a display monitor to a multiple-monitor system programmatically, set DEVMODE.dmFields to DM_POSITION and specify a position (in DEVMODE.dmPosition) for the monitor you are adding that is adjacent to at least one pixel of the display area of an existing monitor. To detach the monitor, set DEVMODE.dmFields to DM_POSITION but set DEVMODE.dmPelsWidth and DEVMODE.dmPelsHeight to zero. For more information, see Multiple Display Monitors .
When the display mode is changed dynamically, the WM_DISPLAYCHANGE message is sent to all running applications with the following message parameters.
ParametersMeaning
wParamNew bits per pixel
LOWORD(lParam)New pixel width
HIWORD(lParam)New pixel height

To change the settings for more than one display at the same time, first call ChangeDisplaySettingsEx for each device individually to update the registry without applying the changes. Then call ChangeDisplaySettingsEx once more, with a NULL device, to apply the changes. For example, to change the settings for two displays, do the following:

ChangeDisplaySettingsEx (lpszDeviceName1, lpDevMode1, NULL, (CDS_UPDATEREGISTRY | CDS_NORESET), NULL);
ChangeDisplaySettingsEx (lpszDeviceName2, lpDevMode2, NULL, (CDS_UPDATEREGISTRY | CDS_NORESET), NULL);
ChangeDisplaySettingsEx (NULL, NULL, NULL, 0, NULL);
Requirements
Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
HeaderWinuser.h (include Windows.h)
LibraryUser32.lib
DLLUser32.dll
Unicode and ANSI namesChangeDisplaySettingsExW (Unicode) and ChangeDisplaySettingsExA (ANSI)
See Also
Device Contexts Overview
Device Context Functions
CreateDC
DEVMODE
EnumDisplayDevices
EnumDisplaySettings
VIDEOPARAMETERS
WM_DISPLAYCHANGE
Send comments about this topic to Microsoft
Build date: 7/11/2009
==原始网址==http://msdn.microsoft.com/en-us/library/dd183413(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 11:29:29