ホーム › System.SystemInformation › GetIntegratedDisplaySize
GetIntegratedDisplaySize
関数内蔵ディスプレイの対角サイズをインチ単位で取得する。
シグネチャ
// api-ms-win-core-sysinfo-l1-2-3.dll
#include <windows.h>
HRESULT GetIntegratedDisplaySize(
DOUBLE* sizeInInches
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| sizeInInches | DOUBLE* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// api-ms-win-core-sysinfo-l1-2-3.dll
#include <windows.h>
HRESULT GetIntegratedDisplaySize(
DOUBLE* sizeInInches
);[DllImport("api-ms-win-core-sysinfo-l1-2-3.dll", ExactSpelling = true)]
static extern int GetIntegratedDisplaySize(
out double sizeInInches // DOUBLE* out
);<DllImport("api-ms-win-core-sysinfo-l1-2-3.dll", ExactSpelling:=True)>
Public Shared Function GetIntegratedDisplaySize(
<Out> ByRef sizeInInches As Double ' DOUBLE* out
) As Integer
End Function' sizeInInches : DOUBLE* out
Declare PtrSafe Function GetIntegratedDisplaySize Lib "api-ms-win-core-sysinfo-l1-2-3" ( _
ByRef sizeInInches As Double) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetIntegratedDisplaySize = ctypes.windll.LoadLibrary("api-ms-win-core-sysinfo-l1-2-3.dll").GetIntegratedDisplaySize
GetIntegratedDisplaySize.restype = ctypes.c_int
GetIntegratedDisplaySize.argtypes = [
ctypes.POINTER(ctypes.c_double), # sizeInInches : DOUBLE* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-core-sysinfo-l1-2-3.dll')
GetIntegratedDisplaySize = Fiddle::Function.new(
lib['GetIntegratedDisplaySize'],
[
Fiddle::TYPE_VOIDP, # sizeInInches : DOUBLE* out
],
Fiddle::TYPE_INT)#[link(name = "api-ms-win-core-sysinfo-l1-2-3")]
extern "system" {
fn GetIntegratedDisplaySize(
sizeInInches: *mut f64 // DOUBLE* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("api-ms-win-core-sysinfo-l1-2-3.dll")]
public static extern int GetIntegratedDisplaySize(out double sizeInInches);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-sysinfo-l1-2-3_GetIntegratedDisplaySize' -Namespace Win32 -PassThru
# $api::GetIntegratedDisplaySize(sizeInInches)#uselib "api-ms-win-core-sysinfo-l1-2-3.dll"
#func global GetIntegratedDisplaySize "GetIntegratedDisplaySize" sptr
; GetIntegratedDisplaySize varptr(sizeInInches) ; 戻り値は stat
; sizeInInches : DOUBLE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "api-ms-win-core-sysinfo-l1-2-3.dll" #cfunc global GetIntegratedDisplaySize "GetIntegratedDisplaySize" var ; res = GetIntegratedDisplaySize(sizeInInches) ; sizeInInches : DOUBLE* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "api-ms-win-core-sysinfo-l1-2-3.dll" #cfunc global GetIntegratedDisplaySize "GetIntegratedDisplaySize" sptr ; res = GetIntegratedDisplaySize(varptr(sizeInInches)) ; sizeInInches : DOUBLE* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT GetIntegratedDisplaySize(DOUBLE* sizeInInches) #uselib "api-ms-win-core-sysinfo-l1-2-3.dll" #cfunc global GetIntegratedDisplaySize "GetIntegratedDisplaySize" var ; res = GetIntegratedDisplaySize(sizeInInches) ; sizeInInches : DOUBLE* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT GetIntegratedDisplaySize(DOUBLE* sizeInInches) #uselib "api-ms-win-core-sysinfo-l1-2-3.dll" #cfunc global GetIntegratedDisplaySize "GetIntegratedDisplaySize" intptr ; res = GetIntegratedDisplaySize(varptr(sizeInInches)) ; sizeInInches : DOUBLE* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_core_sysinfo_l1_2_3 = windows.NewLazySystemDLL("api-ms-win-core-sysinfo-l1-2-3.dll")
procGetIntegratedDisplaySize = api_ms_win_core_sysinfo_l1_2_3.NewProc("GetIntegratedDisplaySize")
)
// sizeInInches (DOUBLE* out)
r1, _, err := procGetIntegratedDisplaySize.Call(
uintptr(sizeInInches),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction GetIntegratedDisplaySize(
sizeInInches: Pointer // DOUBLE* out
): Integer; stdcall;
external 'api-ms-win-core-sysinfo-l1-2-3.dll' name 'GetIntegratedDisplaySize';result := DllCall("api-ms-win-core-sysinfo-l1-2-3\GetIntegratedDisplaySize"
, "Ptr", sizeInInches ; DOUBLE* out
, "Int") ; return: HRESULT●GetIntegratedDisplaySize(sizeInInches) = DLL("api-ms-win-core-sysinfo-l1-2-3.dll", "int GetIntegratedDisplaySize(void*)")
# 呼び出し: GetIntegratedDisplaySize(sizeInInches)
# sizeInInches : DOUBLE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。