Set the Windows 8.1 screen to rotate your code yourself, auto-rotate function code

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.