Starting from Windows CE 4.0,DEVMODEStructure has one more attributeDmDisplayOrientationYou can use this attribute to obtain or set the screen rotation mode. The value is as follows.
DMDO_0 is not rotated
DMDO_90 Rotate 90 degrees
DMDO_180 rotate 180 degrees
DMDO_270 rotate 270 degrees
Http://files.cnblogs.com/zuogang/295-29713.gif
CallChangeDisplaySettingsExFor example:
DEVMODE devmode = {0 };
Devmode. dmSize = sizeof (DEVMODE );
Devmode. dmDisplayOrientation = DMDO_90; // horizontal mode
Devmode. dmFields = DM_DISPLAYORIENTATION;
ChangeDisplaySettingsEx (NULL, & devmode, NULL, 0, NULL );
The code for getting the current mode is as follows:
DEVMODE devmode = {0 };
Devmode. dmSize = sizeof (DEVMODE );
Devmode. dmFields = DM_DISPLAYORIENTATION;
ChangeDisplaySettingsEx (NULL, & devmode, 0, CDS_TEST, NULL );
The value of devmode. dmDisplayOrientation can be used to determine the current mode.
It is worth noting that the switching mode is not permanent and will be restored to the initial state after the device is restarted.
If you need to retain the switching Screen mode, you can set two key values under HKEY_LOCAL_MACHINE \ System \ GDI \ Rotation in the registry.
Angle-DWORD (0, 90,180,270)
LandscapeMode-DWORD (0, 1)