RegisterScaleChangeNotifications
関数スケール変更通知の受信を登録する。
シグネチャ
// api-ms-win-shcore-scaling-l1-1-0.dll
#include <windows.h>
HRESULT RegisterScaleChangeNotifications(
DISPLAY_DEVICE_TYPE displayDevice,
HWND hwndNotify,
DWORD uMsgNotify,
DWORD* pdwCookie
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| displayDevice | DISPLAY_DEVICE_TYPE | in |
| hwndNotify | HWND | in |
| uMsgNotify | DWORD | in |
| pdwCookie | DWORD* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// api-ms-win-shcore-scaling-l1-1-0.dll
#include <windows.h>
HRESULT RegisterScaleChangeNotifications(
DISPLAY_DEVICE_TYPE displayDevice,
HWND hwndNotify,
DWORD uMsgNotify,
DWORD* pdwCookie
);[DllImport("api-ms-win-shcore-scaling-l1-1-0.dll", ExactSpelling = true)]
static extern int RegisterScaleChangeNotifications(
int displayDevice, // DISPLAY_DEVICE_TYPE
IntPtr hwndNotify, // HWND
uint uMsgNotify, // DWORD
out uint pdwCookie // DWORD* out
);<DllImport("api-ms-win-shcore-scaling-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function RegisterScaleChangeNotifications(
displayDevice As Integer, ' DISPLAY_DEVICE_TYPE
hwndNotify As IntPtr, ' HWND
uMsgNotify As UInteger, ' DWORD
<Out> ByRef pdwCookie As UInteger ' DWORD* out
) As Integer
End Function' displayDevice : DISPLAY_DEVICE_TYPE
' hwndNotify : HWND
' uMsgNotify : DWORD
' pdwCookie : DWORD* out
Declare PtrSafe Function RegisterScaleChangeNotifications Lib "api-ms-win-shcore-scaling-l1-1-0" ( _
ByVal displayDevice As Long, _
ByVal hwndNotify As LongPtr, _
ByVal uMsgNotify As Long, _
ByRef pdwCookie As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RegisterScaleChangeNotifications = ctypes.windll.LoadLibrary("api-ms-win-shcore-scaling-l1-1-0.dll").RegisterScaleChangeNotifications
RegisterScaleChangeNotifications.restype = ctypes.c_int
RegisterScaleChangeNotifications.argtypes = [
ctypes.c_int, # displayDevice : DISPLAY_DEVICE_TYPE
wintypes.HANDLE, # hwndNotify : HWND
wintypes.DWORD, # uMsgNotify : DWORD
ctypes.POINTER(wintypes.DWORD), # pdwCookie : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-shcore-scaling-l1-1-0.dll')
RegisterScaleChangeNotifications = Fiddle::Function.new(
lib['RegisterScaleChangeNotifications'],
[
Fiddle::TYPE_INT, # displayDevice : DISPLAY_DEVICE_TYPE
Fiddle::TYPE_VOIDP, # hwndNotify : HWND
-Fiddle::TYPE_INT, # uMsgNotify : DWORD
Fiddle::TYPE_VOIDP, # pdwCookie : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "api-ms-win-shcore-scaling-l1-1-0")]
extern "system" {
fn RegisterScaleChangeNotifications(
displayDevice: i32, // DISPLAY_DEVICE_TYPE
hwndNotify: *mut core::ffi::c_void, // HWND
uMsgNotify: u32, // DWORD
pdwCookie: *mut u32 // DWORD* out
) -> 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 RegisterScaleChangeNotifications(int displayDevice, IntPtr hwndNotify, uint uMsgNotify, out uint pdwCookie);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-shcore-scaling-l1-1-0_RegisterScaleChangeNotifications' -Namespace Win32 -PassThru
# $api::RegisterScaleChangeNotifications(displayDevice, hwndNotify, uMsgNotify, pdwCookie)#uselib "api-ms-win-shcore-scaling-l1-1-0.dll"
#func global RegisterScaleChangeNotifications "RegisterScaleChangeNotifications" sptr, sptr, sptr, sptr
; RegisterScaleChangeNotifications displayDevice, hwndNotify, uMsgNotify, varptr(pdwCookie) ; 戻り値は stat
; displayDevice : DISPLAY_DEVICE_TYPE -> "sptr"
; hwndNotify : HWND -> "sptr"
; uMsgNotify : DWORD -> "sptr"
; pdwCookie : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "api-ms-win-shcore-scaling-l1-1-0.dll" #cfunc global RegisterScaleChangeNotifications "RegisterScaleChangeNotifications" int, sptr, int, var ; res = RegisterScaleChangeNotifications(displayDevice, hwndNotify, uMsgNotify, pdwCookie) ; displayDevice : DISPLAY_DEVICE_TYPE -> "int" ; hwndNotify : HWND -> "sptr" ; uMsgNotify : DWORD -> "int" ; pdwCookie : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "api-ms-win-shcore-scaling-l1-1-0.dll" #cfunc global RegisterScaleChangeNotifications "RegisterScaleChangeNotifications" int, sptr, int, sptr ; res = RegisterScaleChangeNotifications(displayDevice, hwndNotify, uMsgNotify, varptr(pdwCookie)) ; displayDevice : DISPLAY_DEVICE_TYPE -> "int" ; hwndNotify : HWND -> "sptr" ; uMsgNotify : DWORD -> "int" ; pdwCookie : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT RegisterScaleChangeNotifications(DISPLAY_DEVICE_TYPE displayDevice, HWND hwndNotify, DWORD uMsgNotify, DWORD* pdwCookie) #uselib "api-ms-win-shcore-scaling-l1-1-0.dll" #cfunc global RegisterScaleChangeNotifications "RegisterScaleChangeNotifications" int, intptr, int, var ; res = RegisterScaleChangeNotifications(displayDevice, hwndNotify, uMsgNotify, pdwCookie) ; displayDevice : DISPLAY_DEVICE_TYPE -> "int" ; hwndNotify : HWND -> "intptr" ; uMsgNotify : DWORD -> "int" ; pdwCookie : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT RegisterScaleChangeNotifications(DISPLAY_DEVICE_TYPE displayDevice, HWND hwndNotify, DWORD uMsgNotify, DWORD* pdwCookie) #uselib "api-ms-win-shcore-scaling-l1-1-0.dll" #cfunc global RegisterScaleChangeNotifications "RegisterScaleChangeNotifications" int, intptr, int, intptr ; res = RegisterScaleChangeNotifications(displayDevice, hwndNotify, uMsgNotify, varptr(pdwCookie)) ; displayDevice : DISPLAY_DEVICE_TYPE -> "int" ; hwndNotify : HWND -> "intptr" ; uMsgNotify : DWORD -> "int" ; pdwCookie : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
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")
procRegisterScaleChangeNotifications = api_ms_win_shcore_scaling_l1_1_0.NewProc("RegisterScaleChangeNotifications")
)
// displayDevice (DISPLAY_DEVICE_TYPE), hwndNotify (HWND), uMsgNotify (DWORD), pdwCookie (DWORD* out)
r1, _, err := procRegisterScaleChangeNotifications.Call(
uintptr(displayDevice),
uintptr(hwndNotify),
uintptr(uMsgNotify),
uintptr(pdwCookie),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction RegisterScaleChangeNotifications(
displayDevice: Integer; // DISPLAY_DEVICE_TYPE
hwndNotify: THandle; // HWND
uMsgNotify: DWORD; // DWORD
pdwCookie: Pointer // DWORD* out
): Integer; stdcall;
external 'api-ms-win-shcore-scaling-l1-1-0.dll' name 'RegisterScaleChangeNotifications';result := DllCall("api-ms-win-shcore-scaling-l1-1-0\RegisterScaleChangeNotifications"
, "Int", displayDevice ; DISPLAY_DEVICE_TYPE
, "Ptr", hwndNotify ; HWND
, "UInt", uMsgNotify ; DWORD
, "Ptr", pdwCookie ; DWORD* out
, "Int") ; return: HRESULT●RegisterScaleChangeNotifications(displayDevice, hwndNotify, uMsgNotify, pdwCookie) = DLL("api-ms-win-shcore-scaling-l1-1-0.dll", "int RegisterScaleChangeNotifications(int, void*, dword, void*)")
# 呼び出し: RegisterScaleChangeNotifications(displayDevice, hwndNotify, uMsgNotify, pdwCookie)
# displayDevice : DISPLAY_DEVICE_TYPE -> "int"
# hwndNotify : HWND -> "void*"
# uMsgNotify : DWORD -> "dword"
# pdwCookie : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。