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