ホーム › Devices.Display › SetDisplayAutoRotationPreferences
SetDisplayAutoRotationPreferences
関数ディスプレイの画面向きの優先設定を設定する。
シグネチャ
// USER32.dll
#include <windows.h>
BOOL SetDisplayAutoRotationPreferences(
ORIENTATION_PREFERENCE orientation
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| orientation | ORIENTATION_PREFERENCE | in |
戻り値の型: BOOL
各言語での呼び出し定義
// USER32.dll
#include <windows.h>
BOOL SetDisplayAutoRotationPreferences(
ORIENTATION_PREFERENCE orientation
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", ExactSpelling = true)]
static extern bool SetDisplayAutoRotationPreferences(
int orientation // ORIENTATION_PREFERENCE
);<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function SetDisplayAutoRotationPreferences(
orientation As Integer ' ORIENTATION_PREFERENCE
) As Boolean
End Function' orientation : ORIENTATION_PREFERENCE
Declare PtrSafe Function SetDisplayAutoRotationPreferences Lib "user32" ( _
ByVal orientation As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetDisplayAutoRotationPreferences = ctypes.windll.user32.SetDisplayAutoRotationPreferences
SetDisplayAutoRotationPreferences.restype = wintypes.BOOL
SetDisplayAutoRotationPreferences.argtypes = [
ctypes.c_int, # orientation : ORIENTATION_PREFERENCE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USER32.dll')
SetDisplayAutoRotationPreferences = Fiddle::Function.new(
lib['SetDisplayAutoRotationPreferences'],
[
Fiddle::TYPE_INT, # orientation : ORIENTATION_PREFERENCE
],
Fiddle::TYPE_INT)#[link(name = "user32")]
extern "system" {
fn SetDisplayAutoRotationPreferences(
orientation: i32 // ORIENTATION_PREFERENCE
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll")]
public static extern bool SetDisplayAutoRotationPreferences(int orientation);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_SetDisplayAutoRotationPreferences' -Namespace Win32 -PassThru
# $api::SetDisplayAutoRotationPreferences(orientation)#uselib "USER32.dll"
#func global SetDisplayAutoRotationPreferences "SetDisplayAutoRotationPreferences" sptr
; SetDisplayAutoRotationPreferences orientation ; 戻り値は stat
; orientation : ORIENTATION_PREFERENCE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "USER32.dll"
#cfunc global SetDisplayAutoRotationPreferences "SetDisplayAutoRotationPreferences" int
; res = SetDisplayAutoRotationPreferences(orientation)
; orientation : ORIENTATION_PREFERENCE -> "int"; BOOL SetDisplayAutoRotationPreferences(ORIENTATION_PREFERENCE orientation)
#uselib "USER32.dll"
#cfunc global SetDisplayAutoRotationPreferences "SetDisplayAutoRotationPreferences" int
; res = SetDisplayAutoRotationPreferences(orientation)
; orientation : ORIENTATION_PREFERENCE -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
user32 = windows.NewLazySystemDLL("USER32.dll")
procSetDisplayAutoRotationPreferences = user32.NewProc("SetDisplayAutoRotationPreferences")
)
// orientation (ORIENTATION_PREFERENCE)
r1, _, err := procSetDisplayAutoRotationPreferences.Call(
uintptr(orientation),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetDisplayAutoRotationPreferences(
orientation: Integer // ORIENTATION_PREFERENCE
): BOOL; stdcall;
external 'USER32.dll' name 'SetDisplayAutoRotationPreferences';result := DllCall("USER32\SetDisplayAutoRotationPreferences"
, "Int", orientation ; ORIENTATION_PREFERENCE
, "Int") ; return: BOOL●SetDisplayAutoRotationPreferences(orientation) = DLL("USER32.dll", "bool SetDisplayAutoRotationPreferences(int)")
# 呼び出し: SetDisplayAutoRotationPreferences(orientation)
# orientation : ORIENTATION_PREFERENCE -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。