RevokeScaleChangeNotifications
関数スケール変更通知の登録を解除する。
シグネチャ
// api-ms-win-shcore-scaling-l1-1-0.dll
#include <windows.h>
HRESULT RevokeScaleChangeNotifications(
DISPLAY_DEVICE_TYPE displayDevice,
DWORD dwCookie
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| displayDevice | DISPLAY_DEVICE_TYPE | in | 通知の対象とするディスプレイデバイスを示す列挙値です。 |
| dwCookie | DWORD | in | 以前の RegisterScaleChangeNotifications の呼び出しによって返された登録トークンです。 |
戻り値の型: HRESULT
公式ドキュメント
ウィンドウの登録を取り消し、スケーリング情報が変更されたときにコールバックを受け取らないようにします。
戻り値
型: STDAPI
この関数が成功した場合は S_OK を返します。それ以外の場合は HRESULT エラーコードを返します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// api-ms-win-shcore-scaling-l1-1-0.dll
#include <windows.h>
HRESULT RevokeScaleChangeNotifications(
DISPLAY_DEVICE_TYPE displayDevice,
DWORD dwCookie
);[DllImport("api-ms-win-shcore-scaling-l1-1-0.dll", ExactSpelling = true)]
static extern int RevokeScaleChangeNotifications(
int displayDevice, // DISPLAY_DEVICE_TYPE
uint dwCookie // DWORD
);<DllImport("api-ms-win-shcore-scaling-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function RevokeScaleChangeNotifications(
displayDevice As Integer, ' DISPLAY_DEVICE_TYPE
dwCookie As UInteger ' DWORD
) As Integer
End Function' displayDevice : DISPLAY_DEVICE_TYPE
' dwCookie : DWORD
Declare PtrSafe Function RevokeScaleChangeNotifications Lib "api-ms-win-shcore-scaling-l1-1-0" ( _
ByVal displayDevice As Long, _
ByVal dwCookie As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RevokeScaleChangeNotifications = ctypes.windll.LoadLibrary("api-ms-win-shcore-scaling-l1-1-0.dll").RevokeScaleChangeNotifications
RevokeScaleChangeNotifications.restype = ctypes.c_int
RevokeScaleChangeNotifications.argtypes = [
ctypes.c_int, # displayDevice : DISPLAY_DEVICE_TYPE
wintypes.DWORD, # dwCookie : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-shcore-scaling-l1-1-0.dll')
RevokeScaleChangeNotifications = Fiddle::Function.new(
lib['RevokeScaleChangeNotifications'],
[
Fiddle::TYPE_INT, # displayDevice : DISPLAY_DEVICE_TYPE
-Fiddle::TYPE_INT, # dwCookie : DWORD
],
Fiddle::TYPE_INT)#[link(name = "api-ms-win-shcore-scaling-l1-1-0")]
extern "system" {
fn RevokeScaleChangeNotifications(
displayDevice: i32, // DISPLAY_DEVICE_TYPE
dwCookie: u32 // DWORD
) -> 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 RevokeScaleChangeNotifications(int displayDevice, uint dwCookie);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-shcore-scaling-l1-1-0_RevokeScaleChangeNotifications' -Namespace Win32 -PassThru
# $api::RevokeScaleChangeNotifications(displayDevice, dwCookie)#uselib "api-ms-win-shcore-scaling-l1-1-0.dll"
#func global RevokeScaleChangeNotifications "RevokeScaleChangeNotifications" sptr, sptr
; RevokeScaleChangeNotifications displayDevice, dwCookie ; 戻り値は stat
; displayDevice : DISPLAY_DEVICE_TYPE -> "sptr"
; dwCookie : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "api-ms-win-shcore-scaling-l1-1-0.dll"
#cfunc global RevokeScaleChangeNotifications "RevokeScaleChangeNotifications" int, int
; res = RevokeScaleChangeNotifications(displayDevice, dwCookie)
; displayDevice : DISPLAY_DEVICE_TYPE -> "int"
; dwCookie : DWORD -> "int"; HRESULT RevokeScaleChangeNotifications(DISPLAY_DEVICE_TYPE displayDevice, DWORD dwCookie)
#uselib "api-ms-win-shcore-scaling-l1-1-0.dll"
#cfunc global RevokeScaleChangeNotifications "RevokeScaleChangeNotifications" int, int
; res = RevokeScaleChangeNotifications(displayDevice, dwCookie)
; displayDevice : DISPLAY_DEVICE_TYPE -> "int"
; dwCookie : DWORD -> "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")
procRevokeScaleChangeNotifications = api_ms_win_shcore_scaling_l1_1_0.NewProc("RevokeScaleChangeNotifications")
)
// displayDevice (DISPLAY_DEVICE_TYPE), dwCookie (DWORD)
r1, _, err := procRevokeScaleChangeNotifications.Call(
uintptr(displayDevice),
uintptr(dwCookie),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction RevokeScaleChangeNotifications(
displayDevice: Integer; // DISPLAY_DEVICE_TYPE
dwCookie: DWORD // DWORD
): Integer; stdcall;
external 'api-ms-win-shcore-scaling-l1-1-0.dll' name 'RevokeScaleChangeNotifications';result := DllCall("api-ms-win-shcore-scaling-l1-1-0\RevokeScaleChangeNotifications"
, "Int", displayDevice ; DISPLAY_DEVICE_TYPE
, "UInt", dwCookie ; DWORD
, "Int") ; return: HRESULT●RevokeScaleChangeNotifications(displayDevice, dwCookie) = DLL("api-ms-win-shcore-scaling-l1-1-0.dll", "int RevokeScaleChangeNotifications(int, dword)")
# 呼び出し: RevokeScaleChangeNotifications(displayDevice, dwCookie)
# displayDevice : DISPLAY_DEVICE_TYPE -> "int"
# dwCookie : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "api-ms-win-shcore-scaling-l1-1-0" fn RevokeScaleChangeNotifications(
displayDevice: i32, // DISPLAY_DEVICE_TYPE
dwCookie: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;proc RevokeScaleChangeNotifications(
displayDevice: int32, # DISPLAY_DEVICE_TYPE
dwCookie: uint32 # DWORD
): int32 {.importc: "RevokeScaleChangeNotifications", stdcall, dynlib: "api-ms-win-shcore-scaling-l1-1-0.dll".}pragma(lib, "api-ms-win-shcore-scaling-l1-1-0");
extern(Windows)
int RevokeScaleChangeNotifications(
int displayDevice, // DISPLAY_DEVICE_TYPE
uint dwCookie // DWORD
);ccall((:RevokeScaleChangeNotifications, "api-ms-win-shcore-scaling-l1-1-0.dll"), stdcall, Int32,
(Int32, UInt32),
displayDevice, dwCookie)
# displayDevice : DISPLAY_DEVICE_TYPE -> Int32
# dwCookie : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t RevokeScaleChangeNotifications(
int32_t displayDevice,
uint32_t dwCookie);
]]
local api-ms-win-shcore-scaling-l1-1-0 = ffi.load("api-ms-win-shcore-scaling-l1-1-0")
-- api-ms-win-shcore-scaling-l1-1-0.RevokeScaleChangeNotifications(displayDevice, dwCookie)
-- displayDevice : DISPLAY_DEVICE_TYPE
-- dwCookie : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('api-ms-win-shcore-scaling-l1-1-0.dll');
const RevokeScaleChangeNotifications = lib.func('__stdcall', 'RevokeScaleChangeNotifications', 'int32_t', ['int32_t', 'uint32_t']);
// RevokeScaleChangeNotifications(displayDevice, dwCookie)
// displayDevice : DISPLAY_DEVICE_TYPE -> 'int32_t'
// dwCookie : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("api-ms-win-shcore-scaling-l1-1-0.dll", {
RevokeScaleChangeNotifications: { parameters: ["i32", "u32"], result: "i32" },
});
// lib.symbols.RevokeScaleChangeNotifications(displayDevice, dwCookie)
// displayDevice : DISPLAY_DEVICE_TYPE -> "i32"
// dwCookie : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t RevokeScaleChangeNotifications(
int32_t displayDevice,
uint32_t dwCookie);
C, "api-ms-win-shcore-scaling-l1-1-0.dll");
// $ffi->RevokeScaleChangeNotifications(displayDevice, dwCookie);
// displayDevice : DISPLAY_DEVICE_TYPE
// dwCookie : DWORD
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Api-ms-win-shcore-scaling-l1-1-0 extends StdCallLibrary {
Api-ms-win-shcore-scaling-l1-1-0 INSTANCE = Native.load("api-ms-win-shcore-scaling-l1-1-0", Api-ms-win-shcore-scaling-l1-1-0.class);
int RevokeScaleChangeNotifications(
int displayDevice, // DISPLAY_DEVICE_TYPE
int dwCookie // DWORD
);
}@[Link("api-ms-win-shcore-scaling-l1-1-0")]
lib Libapi-ms-win-shcore-scaling-l1-1-0
fun RevokeScaleChangeNotifications = RevokeScaleChangeNotifications(
displayDevice : Int32, # DISPLAY_DEVICE_TYPE
dwCookie : UInt32 # DWORD
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RevokeScaleChangeNotificationsNative = Int32 Function(Int32, Uint32);
typedef RevokeScaleChangeNotificationsDart = int Function(int, int);
final RevokeScaleChangeNotifications = DynamicLibrary.open('api-ms-win-shcore-scaling-l1-1-0.dll')
.lookupFunction<RevokeScaleChangeNotificationsNative, RevokeScaleChangeNotificationsDart>('RevokeScaleChangeNotifications');
// displayDevice : DISPLAY_DEVICE_TYPE -> Int32
// dwCookie : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RevokeScaleChangeNotifications(
displayDevice: Integer; // DISPLAY_DEVICE_TYPE
dwCookie: DWORD // DWORD
): Integer; stdcall;
external 'api-ms-win-shcore-scaling-l1-1-0.dll' name 'RevokeScaleChangeNotifications';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RevokeScaleChangeNotifications"
c_RevokeScaleChangeNotifications :: Int32 -> Word32 -> IO Int32
-- displayDevice : DISPLAY_DEVICE_TYPE -> Int32
-- dwCookie : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let revokescalechangenotifications =
foreign "RevokeScaleChangeNotifications"
(int32_t @-> uint32_t @-> returning int32_t)
(* displayDevice : DISPLAY_DEVICE_TYPE -> int32_t *)
(* dwCookie : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library api-ms-win-shcore-scaling-l1-1-0 (t "api-ms-win-shcore-scaling-l1-1-0.dll"))
(cffi:use-foreign-library api-ms-win-shcore-scaling-l1-1-0)
(cffi:defcfun ("RevokeScaleChangeNotifications" revoke-scale-change-notifications :convention :stdcall) :int32
(display-device :int32) ; DISPLAY_DEVICE_TYPE
(dw-cookie :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RevokeScaleChangeNotifications = Win32::API::More->new('api-ms-win-shcore-scaling-l1-1-0',
'int RevokeScaleChangeNotifications(int displayDevice, DWORD dwCookie)');
# my $ret = $RevokeScaleChangeNotifications->Call($displayDevice, $dwCookie);
# displayDevice : DISPLAY_DEVICE_TYPE -> int
# dwCookie : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f GetScaleFactorForMonitor — 指定モニターの表示スケール係数を取得する。
- f RegisterScaleChangeEvent — スケール変更時にシグナルされるイベントを登録する。
- f UnregisterScaleChangeEvent — スケール変更イベントの登録を解除する。