RegisterAppConstrainedChangeNotification
関数アプリの制約状態変更通知を登録する。
シグネチャ
// api-ms-win-core-psm-appnotify-l1-1-1.dll
#include <windows.h>
DWORD RegisterAppConstrainedChangeNotification(
PAPPCONSTRAIN_CHANGE_ROUTINE Routine,
void* Context, // optional
PAPPCONSTRAIN_REGISTRATION* Registration
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| Routine | PAPPCONSTRAIN_CHANGE_ROUTINE | in |
| Context | void* | inoptional |
| Registration | PAPPCONSTRAIN_REGISTRATION* | out |
戻り値の型: DWORD
各言語での呼び出し定義
// api-ms-win-core-psm-appnotify-l1-1-1.dll
#include <windows.h>
DWORD RegisterAppConstrainedChangeNotification(
PAPPCONSTRAIN_CHANGE_ROUTINE Routine,
void* Context, // optional
PAPPCONSTRAIN_REGISTRATION* Registration
);[DllImport("api-ms-win-core-psm-appnotify-l1-1-1.dll", ExactSpelling = true)]
static extern uint RegisterAppConstrainedChangeNotification(
IntPtr Routine, // PAPPCONSTRAIN_CHANGE_ROUTINE
IntPtr Context, // void* optional
out IntPtr Registration // PAPPCONSTRAIN_REGISTRATION* out
);<DllImport("api-ms-win-core-psm-appnotify-l1-1-1.dll", ExactSpelling:=True)>
Public Shared Function RegisterAppConstrainedChangeNotification(
Routine As IntPtr, ' PAPPCONSTRAIN_CHANGE_ROUTINE
Context As IntPtr, ' void* optional
<Out> ByRef Registration As IntPtr ' PAPPCONSTRAIN_REGISTRATION* out
) As UInteger
End Function' Routine : PAPPCONSTRAIN_CHANGE_ROUTINE
' Context : void* optional
' Registration : PAPPCONSTRAIN_REGISTRATION* out
Declare PtrSafe Function RegisterAppConstrainedChangeNotification Lib "api-ms-win-core-psm-appnotify-l1-1-1" ( _
ByVal Routine As LongPtr, _
ByVal Context As LongPtr, _
ByRef Registration As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RegisterAppConstrainedChangeNotification = ctypes.windll.LoadLibrary("api-ms-win-core-psm-appnotify-l1-1-1.dll").RegisterAppConstrainedChangeNotification
RegisterAppConstrainedChangeNotification.restype = wintypes.DWORD
RegisterAppConstrainedChangeNotification.argtypes = [
ctypes.c_void_p, # Routine : PAPPCONSTRAIN_CHANGE_ROUTINE
ctypes.POINTER(None), # Context : void* optional
ctypes.c_void_p, # Registration : PAPPCONSTRAIN_REGISTRATION* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-core-psm-appnotify-l1-1-1.dll')
RegisterAppConstrainedChangeNotification = Fiddle::Function.new(
lib['RegisterAppConstrainedChangeNotification'],
[
Fiddle::TYPE_VOIDP, # Routine : PAPPCONSTRAIN_CHANGE_ROUTINE
Fiddle::TYPE_VOIDP, # Context : void* optional
Fiddle::TYPE_VOIDP, # Registration : PAPPCONSTRAIN_REGISTRATION* out
],
-Fiddle::TYPE_INT)#[link(name = "api-ms-win-core-psm-appnotify-l1-1-1")]
extern "system" {
fn RegisterAppConstrainedChangeNotification(
Routine: *const core::ffi::c_void, // PAPPCONSTRAIN_CHANGE_ROUTINE
Context: *mut (), // void* optional
Registration: *mut isize // PAPPCONSTRAIN_REGISTRATION* out
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("api-ms-win-core-psm-appnotify-l1-1-1.dll")]
public static extern uint RegisterAppConstrainedChangeNotification(IntPtr Routine, IntPtr Context, out IntPtr Registration);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-psm-appnotify-l1-1-1_RegisterAppConstrainedChangeNotification' -Namespace Win32 -PassThru
# $api::RegisterAppConstrainedChangeNotification(Routine, Context, Registration)#uselib "api-ms-win-core-psm-appnotify-l1-1-1.dll"
#func global RegisterAppConstrainedChangeNotification "RegisterAppConstrainedChangeNotification" sptr, sptr, sptr
; RegisterAppConstrainedChangeNotification Routine, Context, Registration ; 戻り値は stat
; Routine : PAPPCONSTRAIN_CHANGE_ROUTINE -> "sptr"
; Context : void* optional -> "sptr"
; Registration : PAPPCONSTRAIN_REGISTRATION* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "api-ms-win-core-psm-appnotify-l1-1-1.dll"
#cfunc global RegisterAppConstrainedChangeNotification "RegisterAppConstrainedChangeNotification" sptr, sptr, int
; res = RegisterAppConstrainedChangeNotification(Routine, Context, Registration)
; Routine : PAPPCONSTRAIN_CHANGE_ROUTINE -> "sptr"
; Context : void* optional -> "sptr"
; Registration : PAPPCONSTRAIN_REGISTRATION* out -> "int"; DWORD RegisterAppConstrainedChangeNotification(PAPPCONSTRAIN_CHANGE_ROUTINE Routine, void* Context, PAPPCONSTRAIN_REGISTRATION* Registration)
#uselib "api-ms-win-core-psm-appnotify-l1-1-1.dll"
#cfunc global RegisterAppConstrainedChangeNotification "RegisterAppConstrainedChangeNotification" intptr, intptr, int
; res = RegisterAppConstrainedChangeNotification(Routine, Context, Registration)
; Routine : PAPPCONSTRAIN_CHANGE_ROUTINE -> "intptr"
; Context : void* optional -> "intptr"
; Registration : PAPPCONSTRAIN_REGISTRATION* out -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_core_psm_appnotify_l1_1_1 = windows.NewLazySystemDLL("api-ms-win-core-psm-appnotify-l1-1-1.dll")
procRegisterAppConstrainedChangeNotification = api_ms_win_core_psm_appnotify_l1_1_1.NewProc("RegisterAppConstrainedChangeNotification")
)
// Routine (PAPPCONSTRAIN_CHANGE_ROUTINE), Context (void* optional), Registration (PAPPCONSTRAIN_REGISTRATION* out)
r1, _, err := procRegisterAppConstrainedChangeNotification.Call(
uintptr(Routine),
uintptr(Context),
uintptr(Registration),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction RegisterAppConstrainedChangeNotification(
Routine: Pointer; // PAPPCONSTRAIN_CHANGE_ROUTINE
Context: Pointer; // void* optional
Registration: Pointer // PAPPCONSTRAIN_REGISTRATION* out
): DWORD; stdcall;
external 'api-ms-win-core-psm-appnotify-l1-1-1.dll' name 'RegisterAppConstrainedChangeNotification';result := DllCall("api-ms-win-core-psm-appnotify-l1-1-1\RegisterAppConstrainedChangeNotification"
, "Ptr", Routine ; PAPPCONSTRAIN_CHANGE_ROUTINE
, "Ptr", Context ; void* optional
, "Ptr", Registration ; PAPPCONSTRAIN_REGISTRATION* out
, "UInt") ; return: DWORD●RegisterAppConstrainedChangeNotification(Routine, Context, Registration) = DLL("api-ms-win-core-psm-appnotify-l1-1-1.dll", "dword RegisterAppConstrainedChangeNotification(void*, void*, void*)")
# 呼び出し: RegisterAppConstrainedChangeNotification(Routine, Context, Registration)
# Routine : PAPPCONSTRAIN_CHANGE_ROUTINE -> "void*"
# Context : void* optional -> "void*"
# Registration : PAPPCONSTRAIN_REGISTRATION* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。