Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize the function of turning screen under WM

Shulou Source: shulou.com Published: 2022-06-03 09:48:19 11月15日 Update

The purpose of this article is to share with you about how to realize the screen transfer function under WM. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Under WM, users can often turn the screen, but this can also be achieved through code, here is a tested code.

Int ChangeDisplaySettings () {DEVMODE DevMode; int RotationAngles = 0; int CurrentAngle = 0; int NewAngle = 0; / / Check for rotation support by getting the rotation angles supported. Memset (& DevMode, 0, sizeof (DevMode)); DevMode.dmSize = sizeof (DevMode); DevMode.dmFields = DM_DISPLAYQUERYORIENTATION; if (DISP_CHANGE_SUCCESSFUL = = ChangeDisplaySettingsEx (NULL, & DevMode, NULL, CDS_TEST, NULL)) {RotationAngles = DevMode.dmDisplayOrientation;} else {RotationAngles =-1;} / / Get the current rotation angle. Memset (& DevMode, 0, sizeof (DevMode)); DevMode.dmSize = sizeof (DevMode); DevMode.dmFields = DM_DISPLAYORIENTATION; if (DISP_CHANGE_SUCCESSFUL = = ChangeDisplaySettingsEx (NULL, & DevMode, NULL, CDS_TEST, NULL)) {CurrentAngle = DevMode.dmDisplayOrientation;} else {CurrentAngle =-1;} / Rotate to the "next" angle. If ((CurrentAngle > = 0) & & (RotationAngles > = 0)) {NewAngle = CurrentAngle; do {NewAngle

Tags: Features code content more articles good practical articles users look knowledge reference help related testing Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Redmi Apple MySQL Huawei