How to get the screen auto-rotate's status?

前端 未结 5 1529
谎友^
谎友^ 2020-12-10 09:18

How to get the screen auto-rotate\'s status (disable or enable) by Regetry or ACPI in windows8?

I need to disable screen auto-rotate, and I will use winkey + O to c

5条回答
  •  春和景丽
    2020-12-10 09:46

    Below maybe helpful if you want to change auto-rotate status:

    //C++
    typedef BOOL (WINAPI* SETAUTOROTATION)(BOOL bEnable);
    
    SETAUTOROTATION SetAutoRotation = (SETAUTOROTATION)GetProcAddress(GetModuleHandle(TEXT("user32.dll")), (LPCSTR)2507);
    if(SetAutoRotation != NULL)
    {
      SetAutoRotation(TRUE);
    }
    

    or

    //C#
    [DllImport("user32.dll", EntryPoint = "#2507")]
    extern static bool SetAutoRotation(bool bEnable);
    
    SetAutoRotation(true);
    

提交回复
热议问题