Program code implementation enable or disable the Windows 8.1 tablet's own active rotation feature
Method One: Use the Setdisplayautorotationpreferences function function
#include <windows.h>/*typedef enum orientation_preference { Orientation_preference_none = 0x0, Orientation_preference_landscape = 0x1, orientation_preference_portrait = 0x2, orientation_ preference_landscape_flipped = 0x4, orientation_preference_portrait_flipped = 0x8}orientation_preference; */typedef BOOL (WINAPI *psdarp) (orientation_preference ORIENTATION);p sdarp parp;int Main (int argc, char* argv[]) {PARP = ( Psdarp) GetProcAddress (GetModuleHandle (TEXT ("user32.dll")), "Setdisplayautorotationpreferences"), if (PARP) { if (Atoi (argv[1]) = = 0) {PARP (orientation_preference) (Orientation_preference_landscape | orientation_preference_landscape_flipped));} if (Atoi (argv[1]) = = 1) {PARP ((orientation_preference) (Orientation_preference_none));}} else{printf ("System not supported.\t"); return 1;} return 0;}
Method Two: Set by the Write register to enable.
1 means enable self-active rotation, 0 to prevent self-rotation
The location of the detailed key is as follows:
Key_local_machine\software\microsoft\windows\currentversion\autorotation
Set the Windows 8.1 screen to rotate your code yourself, auto-rotate function code