Win32 API 日本語リファレンス
ホームUI.Shell › GetDpiForShellUIComponent

GetDpiForShellUIComponent

関数
シェルUIコンポーネントのDPI値を取得する。
DLLapi-ms-win-shcore-scaling-l1-1-2.dll呼出規約winapi対応OSWindows 8.1 以降

シグネチャ

// api-ms-win-shcore-scaling-l1-1-2.dll
#include <windows.h>

DWORD GetDpiForShellUIComponent(
    SHELL_UI_COMPONENT param0
);

パラメーター

名前方向
param0SHELL_UI_COMPONENTin

戻り値の型: DWORD

各言語での呼び出し定義

// api-ms-win-shcore-scaling-l1-1-2.dll
#include <windows.h>

DWORD GetDpiForShellUIComponent(
    SHELL_UI_COMPONENT param0
);
[DllImport("api-ms-win-shcore-scaling-l1-1-2.dll", ExactSpelling = true)]
static extern uint GetDpiForShellUIComponent(
    int param0   // SHELL_UI_COMPONENT
);
<DllImport("api-ms-win-shcore-scaling-l1-1-2.dll", ExactSpelling:=True)>
Public Shared Function GetDpiForShellUIComponent(
    param0 As Integer   ' SHELL_UI_COMPONENT
) As UInteger
End Function
' param0 : SHELL_UI_COMPONENT
Declare PtrSafe Function GetDpiForShellUIComponent Lib "api-ms-win-shcore-scaling-l1-1-2" ( _
    ByVal param0 As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetDpiForShellUIComponent = ctypes.windll.LoadLibrary("api-ms-win-shcore-scaling-l1-1-2.dll").GetDpiForShellUIComponent
GetDpiForShellUIComponent.restype = wintypes.DWORD
GetDpiForShellUIComponent.argtypes = [
    ctypes.c_int,  # param0 : SHELL_UI_COMPONENT
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('api-ms-win-shcore-scaling-l1-1-2.dll')
GetDpiForShellUIComponent = Fiddle::Function.new(
  lib['GetDpiForShellUIComponent'],
  [
    Fiddle::TYPE_INT,  # param0 : SHELL_UI_COMPONENT
  ],
  -Fiddle::TYPE_INT)
#[link(name = "api-ms-win-shcore-scaling-l1-1-2")]
extern "system" {
    fn GetDpiForShellUIComponent(
        param0: i32  // SHELL_UI_COMPONENT
    ) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("api-ms-win-shcore-scaling-l1-1-2.dll")]
public static extern uint GetDpiForShellUIComponent(int param0);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-shcore-scaling-l1-1-2_GetDpiForShellUIComponent' -Namespace Win32 -PassThru
# $api::GetDpiForShellUIComponent(param0)
#uselib "api-ms-win-shcore-scaling-l1-1-2.dll"
#func global GetDpiForShellUIComponent "GetDpiForShellUIComponent" sptr
; GetDpiForShellUIComponent param0   ; 戻り値は stat
; param0 : SHELL_UI_COMPONENT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "api-ms-win-shcore-scaling-l1-1-2.dll"
#cfunc global GetDpiForShellUIComponent "GetDpiForShellUIComponent" int
; res = GetDpiForShellUIComponent(param0)
; param0 : SHELL_UI_COMPONENT -> "int"
; DWORD GetDpiForShellUIComponent(SHELL_UI_COMPONENT param0)
#uselib "api-ms-win-shcore-scaling-l1-1-2.dll"
#cfunc global GetDpiForShellUIComponent "GetDpiForShellUIComponent" int
; res = GetDpiForShellUIComponent(param0)
; param0 : SHELL_UI_COMPONENT -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	api_ms_win_shcore_scaling_l1_1_2 = windows.NewLazySystemDLL("api-ms-win-shcore-scaling-l1-1-2.dll")
	procGetDpiForShellUIComponent = api_ms_win_shcore_scaling_l1_1_2.NewProc("GetDpiForShellUIComponent")
)

// param0 (SHELL_UI_COMPONENT)
r1, _, err := procGetDpiForShellUIComponent.Call(
	uintptr(param0),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // DWORD
function GetDpiForShellUIComponent(
  param0: Integer   // SHELL_UI_COMPONENT
): DWORD; stdcall;
  external 'api-ms-win-shcore-scaling-l1-1-2.dll' name 'GetDpiForShellUIComponent';
result := DllCall("api-ms-win-shcore-scaling-l1-1-2\GetDpiForShellUIComponent"
    , "Int", param0   ; SHELL_UI_COMPONENT
    , "UInt")   ; return: DWORD
●GetDpiForShellUIComponent(param0) = DLL("api-ms-win-shcore-scaling-l1-1-2.dll", "dword GetDpiForShellUIComponent(int)")
# 呼び出し: GetDpiForShellUIComponent(param0)
# param0 : SHELL_UI_COMPONENT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。