ChangeDisplaySettingsEx函数

Display驱动里面,GetModeInfo;NumModes等函数需要告诉OS有两种显示模式,例如一个是320*240 16bpp,另一个是320*240 24bpp。然后调用ChangeDisplaySettingsEx,上层应该就会调用驱动的SetMode来切换显示模式。完全不用重新启动。可以参考微软的例子wince500/public/common/oak/csp/x86/geode/gxvideo/base/Misc.cpp
8/27/2009

 

This function changes the settings of the specified display device to the specified graphics mode.

Syntax

 
LONG ChangeDisplaySettingsEx(
  LPCTSTR lpszDeviceName,
  LPDEVMODE lpDevMode,
  HWND hwnd,
  DWORD dwflags,
  LPVOID lParam
);

Parameters

lpszDeviceName

[in] Not used. Set to NULL.

lpDevMode

[in, out] Pointer to a DEVMODE structure that describes the new graphics mode.

If lpDevMode is NULL, ChangeDisplaySettingsEx uses all of the values currently in the registry 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.

You must initialize the dmSize member of the DEVMODE structure with the size, in bytes, of the structure. The following table shows the members of the DEVMODE structure that you can use.

Value Description

dmPelsWidth

 

For Windows Embedded CE 6.0 and later versions, this value indicates pixel width.

dmPelsHeight

 

For Windows Embedded CE 6.0 and later versions, this value indicates pixel height.

dmDisplayOrientation

Screen rotation.

Screen rotation is not supported on platforms with multiple screens.

Setting the dmBitsPerPel member is not supported.

The following table shows the values in the dmFields member that you must also set to change the display settings, in addition to using one or more of the preceding DEVMODE members.

Value Description

DM_DISPLAYQUERYORIENTATION

Check whether the display driver supports screen rotation.

The supported screen orientations are returned in lpDevMode.dmDisplayOrientation.

A value of just DMO_0 indicates that screen rotation is not supported.

DM_DISPLAYORIENTATION

Use the dmDisplayOrientation value to change the orientation of the screen.

DM_PELSWIDTH

 

For Windows Embedded CE 6.0 and later versions, this value indicates to use the dmPelsWidth value.

DM_PELSHEIGHT

 

For Windows Embedded CE 6.0 and later versions, this value indicates to use the dmPelsHeight value.

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.

hwnd

[in] Reserved; must be NULL.

dwflags

[in] DWORD that indicates how you want to change the graphics mode. The following table shows the possible values.

Value Description

0

Changes the graphics mode for the current screen dynamically.

CDS_RESET

Changes the settings even if the requested settings are the same as the current settings.

CDS_TEST

Tests if ChangeDisplaySettingsEx can set the requested graphics mode.

Specifying CDS_TEST allows an application to determine which graphics modes are actually valid, without causing the system to change to the settings.

CDS_VIDEOPARAMETERS

Indicates that the lParam parameter is a pointer to a VIDEOPARAMETERS structure.

lParam

[in] Pointer to a VIDEOPARAMETERS structure if dwFlags is CDS_VIDEOPARAMETERS. Otherwise, set to NULL.

Return Value

The following table shows the possible return values.

Value Description

DISP_CHANGE_SUCCESSFUL

The settings change was successful.

DISP_CHANGE_BADFLAGS

An invalid set of values was used in the dwFlags parameter.

DISP_CHANGE_BADMODE

The graphics mode is not supported.

DISP_CHANGE_BADPARAM

An invalid parameter was used.

This error can include an invalid value or combination of values.

DISP_CHANGE_FAILED

The display driver failed the specified graphics mode.

DISP_CHANGE_NOTUPDATED

ChangeDisplaySettingsEx was unable to write settings to the registry.

DISP_CHANGE_RESTART

The user must restart the computer for the graphics mode to work.

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值