Autorotation on Win8.1

321 Views Asked by At

I want to turn on resp. off the Autorotation-feature in Win8.1. pro grammatically (and not like in query it!) .

With ProcessMonitor I figured out, that when changing the DisplaySettings the following key is set:

HKLM\SOFTWARE\MICROSOFT\Windows\CurrentVersion\AutoRotation\Enable

when I do a change manually with regEdit (or PowerShell) then the change is not reflected in the system, i.e.

  • the display-settings ignore manual changes (i.e. old value remains)
  • rotation-changes on my tablet are ignored

Question:

Do I need to do any other special update? Or do I need to run the update differently? Or is the reg-key not valid?

2

There are 2 best solutions below

0
On

Anyone has the answer to this question?

I found out that changing the 'Enable' value works, but only if I first enable the "Allow the screen to auto-rotate" option in Control Panel/Screen Resolution.

0
On

Finally, here's the solution:

SETAUTOROTATION SetAutoRotation = (SETAUTOROTATION)GetProcAddress(GetModuleHandle(L"user32.dll"), (LPCSTR)2507);
if (SetAutoRotation != nullptr)
{
    if (!SetAutoRotation(THE_SETTING))
    {
        // An error occurred
    }
}

Found on this post: How to get the screen auto-rotate's status?