How to rotate the screen of Windows Mobile 2003

xiaoxiao2021-03-06  54

How can I get the current screen mode of Windows Mobile 2003 in my program (horizontal / vertical)? Can I switch by program? Starting from Windows CE 4.0, the DEVMODE structure has more attribute DMDisplayorient, which you can get or set the screen rotation mode through this property, which corresponds to the following:

DMDO_0 does not rotate DMDO_90 Rotate 90 degrees DMDO_180 Rotate 180 degrees DMDO_270 Rotate 270 degrees

Switch screen rotation mode is implemented by calling ChangeDisplaySettingSex, such as:

DEVMODE DEVMODE = {0}; devmode.dmsize = sizeof (devmode.dmdisplayorientation = dmdo_90; // horizontal mode

Devmode.dmfields = DM_DISPLAYORIETATION; ChangeDisplaySettingsex (Null, & devmode, null, 0, null); the code for obtaining the current mode is as follows:

DEVMODE devmode = {0}; devmode.dmSize = sizeof (DEVMODE); devmode.dmFields = DM_DISPLAYORIENTATION; ChangeDisplaySettingsEx (NULL, & devmode, 0, CDS_TEST, NULL); a value based on the current mode of devmode.dmDisplayOrientation. It is worth noting that such switching mode is not permanent. When the device is restarted, it will be restored to the initial state. If you need to keep the switching screen mode, you can implement two key values ​​under HKEY_LOCAL_MACHINE / System / GDI / Rotation by setting the registry.

Angle - DWORD (0, 90, 180, 270) LandscapeMode - DWORD (0, 1)

转载请注明原文地址:https://www.9cbs.com/read-116534.html

New Post(0)