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