共用方式為


SetDisplayAutoRotationPreferences function

Sets the orientation preferences of the display.

Syntax

BOOL WINAPI SetDisplayAutoRotationPreferences(
  _In_ ORIENTATION_PREFERENCE orientation
);

Parameters

  • orientation [in]
    Type: ORIENTATION_PREFERENCE

    A combination of ORIENTATION_PREFERENCE-typed values that are combined by using a bitwise OR operation. The resulting value specifies the orientation preferences of the display. Here are possible values:

    Value Meaning
    ORIENTATION_PREFERENCE_NONE 0x0

    No display orientation is specified.

    ORIENTATION_PREFERENCE_LANDSCAPE 0x1

    Specifies that the display can be oriented in landscape mode where the width of the display viewing area is greater than the height.

    ORIENTATION_PREFERENCE_PORTRAIT 0x2

    Specifies that the display can be oriented in portrait mode where the height of the display viewing area is greater than the width.

    ORIENTATION_PREFERENCE_LANDSCAPE_FLIPPED 0x4

    Specifies that the display can be oriented in flipped landscape mode where the width of the display viewing area is greater than the height. This landscape mode is flipped 180 degrees from ORIENTATION_PREFERENCE_LANDSCAPE mode.

    ORIENTATION_PREFERENCE_PORTRAIT_FLIPPED 0x8

    Specifies that the display can be oriented in flipped portrait mode where the height of the display viewing area is greater than the width. This portrait mode is flipped 180 degrees from the ORIENTATION_PREFERENCE_PORTRAIT mode.

     

Return value

Type: BOOL

If this function set the orientation preferences, the return value is nonzero.

If the orientation preferences weren't set, the return value is zero.

Remarks

An app can remove the orientation preferences of the display after it sets them by passing ORIENTATION_PREFERENCE_NONE to SetDisplayAutoRotationPreferences. An app can change the orientation preferences of the display by passing a different combination of ORIENTATION_PREFERENCE-typed values to SetDisplayAutoRotationPreferences.

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

GetDisplayAutoRotationPreferences