Win32 API 日本語リファレンス
ホームDevices.Display › GetAutoRotationState

GetAutoRotationState

関数
デバイスの画面自動回転の状態を取得する。
DLLUSER32.dll呼出規約winapi

シグネチャ

// USER32.dll
#include <windows.h>

BOOL GetAutoRotationState(
    AR_STATE* pState
);

パラメーター

名前方向
pStateAR_STATE*out

戻り値の型: BOOL

各言語での呼び出し定義

// USER32.dll
#include <windows.h>

BOOL GetAutoRotationState(
    AR_STATE* pState
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", ExactSpelling = true)]
static extern bool GetAutoRotationState(
    out int pState   // AR_STATE* out
);
<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function GetAutoRotationState(
    <Out> ByRef pState As Integer   ' AR_STATE* out
) As Boolean
End Function
' pState : AR_STATE* out
Declare PtrSafe Function GetAutoRotationState Lib "user32" ( _
    ByRef pState As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetAutoRotationState = ctypes.windll.user32.GetAutoRotationState
GetAutoRotationState.restype = wintypes.BOOL
GetAutoRotationState.argtypes = [
    ctypes.c_void_p,  # pState : AR_STATE* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
GetAutoRotationState = Fiddle::Function.new(
  lib['GetAutoRotationState'],
  [
    Fiddle::TYPE_VOIDP,  # pState : AR_STATE* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn GetAutoRotationState(
        pState: *mut i32  // AR_STATE* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll")]
public static extern bool GetAutoRotationState(out int pState);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_GetAutoRotationState' -Namespace Win32 -PassThru
# $api::GetAutoRotationState(pState)
#uselib "USER32.dll"
#func global GetAutoRotationState "GetAutoRotationState" sptr
; GetAutoRotationState pState   ; 戻り値は stat
; pState : AR_STATE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "USER32.dll"
#cfunc global GetAutoRotationState "GetAutoRotationState" int
; res = GetAutoRotationState(pState)
; pState : AR_STATE* out -> "int"
; BOOL GetAutoRotationState(AR_STATE* pState)
#uselib "USER32.dll"
#cfunc global GetAutoRotationState "GetAutoRotationState" int
; res = GetAutoRotationState(pState)
; pState : AR_STATE* out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procGetAutoRotationState = user32.NewProc("GetAutoRotationState")
)

// pState (AR_STATE* out)
r1, _, err := procGetAutoRotationState.Call(
	uintptr(pState),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function GetAutoRotationState(
  pState: Pointer   // AR_STATE* out
): BOOL; stdcall;
  external 'USER32.dll' name 'GetAutoRotationState';
result := DllCall("USER32\GetAutoRotationState"
    , "Ptr", pState   ; AR_STATE* out
    , "Int")   ; return: BOOL
●GetAutoRotationState(pState) = DLL("USER32.dll", "bool GetAutoRotationState(void*)")
# 呼び出し: GetAutoRotationState(pState)
# pState : AR_STATE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。