Win32 API 日本語リファレンス
ホームSystem.WindowsProgramming › SubscribeFeatureStateChangeNotification

SubscribeFeatureStateChangeNotification

関数
フィーチャー状態変化の通知を購読する。
DLLapi-ms-win-core-featurestaging-l1-1-0.dll呼出規約winapi

シグネチャ

// api-ms-win-core-featurestaging-l1-1-0.dll
#include <windows.h>

void SubscribeFeatureStateChangeNotification(
    FEATURE_STATE_CHANGE_SUBSCRIPTION* subscription,
    PFEATURE_STATE_CHANGE_CALLBACK callback,
    void* context   // optional
);

パラメーター

名前方向説明
subscriptionFEATURE_STATE_CHANGE_SUBSCRIPTION*out登録結果を受け取る購読ハンドル用FEATURE_STATE_CHANGE_SUBSCRIPTION変数へのポインタ。
callbackPFEATURE_STATE_CHANGE_CALLBACKin状態変更時に呼び出されるコールバック関数へのポインタ。
contextvoid*inoptionalコールバックに渡される呼び出し側定義のコンテキストポインタ。NULL可。

戻り値の型: void

各言語での呼び出し定義

// api-ms-win-core-featurestaging-l1-1-0.dll
#include <windows.h>

void SubscribeFeatureStateChangeNotification(
    FEATURE_STATE_CHANGE_SUBSCRIPTION* subscription,
    PFEATURE_STATE_CHANGE_CALLBACK callback,
    void* context   // optional
);
[DllImport("api-ms-win-core-featurestaging-l1-1-0.dll", ExactSpelling = true)]
static extern void SubscribeFeatureStateChangeNotification(
    IntPtr subscription,   // FEATURE_STATE_CHANGE_SUBSCRIPTION* out
    IntPtr callback,   // PFEATURE_STATE_CHANGE_CALLBACK
    IntPtr context   // void* optional
);
<DllImport("api-ms-win-core-featurestaging-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Sub SubscribeFeatureStateChangeNotification(
    subscription As IntPtr,   ' FEATURE_STATE_CHANGE_SUBSCRIPTION* out
    callback As IntPtr,   ' PFEATURE_STATE_CHANGE_CALLBACK
    context As IntPtr   ' void* optional
)
End Sub
' subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out
' callback : PFEATURE_STATE_CHANGE_CALLBACK
' context : void* optional
Declare PtrSafe Sub SubscribeFeatureStateChangeNotification Lib "api-ms-win-core-featurestaging-l1-1-0" ( _
    ByVal subscription As LongPtr, _
    ByVal callback As LongPtr, _
    ByVal context As LongPtr)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

SubscribeFeatureStateChangeNotification = ctypes.windll.LoadLibrary("api-ms-win-core-featurestaging-l1-1-0.dll").SubscribeFeatureStateChangeNotification
SubscribeFeatureStateChangeNotification.restype = None
SubscribeFeatureStateChangeNotification.argtypes = [
    ctypes.c_void_p,  # subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out
    ctypes.c_void_p,  # callback : PFEATURE_STATE_CHANGE_CALLBACK
    ctypes.POINTER(None),  # context : void* optional
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('api-ms-win-core-featurestaging-l1-1-0.dll')
SubscribeFeatureStateChangeNotification = Fiddle::Function.new(
  lib['SubscribeFeatureStateChangeNotification'],
  [
    Fiddle::TYPE_VOIDP,  # subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out
    Fiddle::TYPE_VOIDP,  # callback : PFEATURE_STATE_CHANGE_CALLBACK
    Fiddle::TYPE_VOIDP,  # context : void* optional
  ],
  Fiddle::TYPE_VOID)
#[link(name = "api-ms-win-core-featurestaging-l1-1-0")]
extern "system" {
    fn SubscribeFeatureStateChangeNotification(
        subscription: *mut *mut core::ffi::c_void,  // FEATURE_STATE_CHANGE_SUBSCRIPTION* out
        callback: *const core::ffi::c_void,  // PFEATURE_STATE_CHANGE_CALLBACK
        context: *mut ()  // void* optional
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("api-ms-win-core-featurestaging-l1-1-0.dll")]
public static extern void SubscribeFeatureStateChangeNotification(IntPtr subscription, IntPtr callback, IntPtr context);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-featurestaging-l1-1-0_SubscribeFeatureStateChangeNotification' -Namespace Win32 -PassThru
# $api::SubscribeFeatureStateChangeNotification(subscription, callback, context)
#uselib "api-ms-win-core-featurestaging-l1-1-0.dll"
#func global SubscribeFeatureStateChangeNotification "SubscribeFeatureStateChangeNotification" sptr, sptr, sptr
; SubscribeFeatureStateChangeNotification subscription, callback, context
; subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out -> "sptr"
; callback : PFEATURE_STATE_CHANGE_CALLBACK -> "sptr"
; context : void* optional -> "sptr"
#uselib "api-ms-win-core-featurestaging-l1-1-0.dll"
#func global SubscribeFeatureStateChangeNotification "SubscribeFeatureStateChangeNotification" sptr, sptr, sptr
; SubscribeFeatureStateChangeNotification subscription, callback, context
; subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out -> "sptr"
; callback : PFEATURE_STATE_CHANGE_CALLBACK -> "sptr"
; context : void* optional -> "sptr"
; void SubscribeFeatureStateChangeNotification(FEATURE_STATE_CHANGE_SUBSCRIPTION* subscription, PFEATURE_STATE_CHANGE_CALLBACK callback, void* context)
#uselib "api-ms-win-core-featurestaging-l1-1-0.dll"
#func global SubscribeFeatureStateChangeNotification "SubscribeFeatureStateChangeNotification" intptr, intptr, intptr
; SubscribeFeatureStateChangeNotification subscription, callback, context
; subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out -> "intptr"
; callback : PFEATURE_STATE_CHANGE_CALLBACK -> "intptr"
; context : void* optional -> "intptr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	api_ms_win_core_featurestaging_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-featurestaging-l1-1-0.dll")
	procSubscribeFeatureStateChangeNotification = api_ms_win_core_featurestaging_l1_1_0.NewProc("SubscribeFeatureStateChangeNotification")
)

// subscription (FEATURE_STATE_CHANGE_SUBSCRIPTION* out), callback (PFEATURE_STATE_CHANGE_CALLBACK), context (void* optional)
r1, _, err := procSubscribeFeatureStateChangeNotification.Call(
	uintptr(subscription),
	uintptr(callback),
	uintptr(context),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure SubscribeFeatureStateChangeNotification(
  subscription: Pointer;   // FEATURE_STATE_CHANGE_SUBSCRIPTION* out
  callback: Pointer;   // PFEATURE_STATE_CHANGE_CALLBACK
  context: Pointer   // void* optional
); stdcall;
  external 'api-ms-win-core-featurestaging-l1-1-0.dll' name 'SubscribeFeatureStateChangeNotification';
result := DllCall("api-ms-win-core-featurestaging-l1-1-0\SubscribeFeatureStateChangeNotification"
    , "Ptr", subscription   ; FEATURE_STATE_CHANGE_SUBSCRIPTION* out
    , "Ptr", callback   ; PFEATURE_STATE_CHANGE_CALLBACK
    , "Ptr", context   ; void* optional
    , "Int")   ; return: void
●SubscribeFeatureStateChangeNotification(subscription, callback, context) = DLL("api-ms-win-core-featurestaging-l1-1-0.dll", "int SubscribeFeatureStateChangeNotification(void*, void*, void*)")
# 呼び出し: SubscribeFeatureStateChangeNotification(subscription, callback, context)
# subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out -> "void*"
# callback : PFEATURE_STATE_CHANGE_CALLBACK -> "void*"
# context : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "api-ms-win-core-featurestaging-l1-1-0" fn SubscribeFeatureStateChangeNotification(
    subscription: ?*anyopaque, // FEATURE_STATE_CHANGE_SUBSCRIPTION* out
    callback: ?*anyopaque, // PFEATURE_STATE_CHANGE_CALLBACK
    context: ?*anyopaque // void* optional
) callconv(std.os.windows.WINAPI) void;
proc SubscribeFeatureStateChangeNotification(
    subscription: pointer,  # FEATURE_STATE_CHANGE_SUBSCRIPTION* out
    callback: pointer,  # PFEATURE_STATE_CHANGE_CALLBACK
    context: pointer  # void* optional
) {.importc: "SubscribeFeatureStateChangeNotification", stdcall, dynlib: "api-ms-win-core-featurestaging-l1-1-0.dll".}
pragma(lib, "api-ms-win-core-featurestaging-l1-1-0");
extern(Windows)
void SubscribeFeatureStateChangeNotification(
    void* subscription,   // FEATURE_STATE_CHANGE_SUBSCRIPTION* out
    void* callback,   // PFEATURE_STATE_CHANGE_CALLBACK
    void* context   // void* optional
);
ccall((:SubscribeFeatureStateChangeNotification, "api-ms-win-core-featurestaging-l1-1-0.dll"), stdcall, Cvoid,
      (Ptr{Cvoid}, Ptr{Cvoid}, Ptr{Cvoid}),
      subscription, callback, context)
# subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out -> Ptr{Cvoid}
# callback : PFEATURE_STATE_CHANGE_CALLBACK -> Ptr{Cvoid}
# context : void* optional -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
void SubscribeFeatureStateChangeNotification(
    void* subscription,
    void* callback,
    void* context);
]]
local api-ms-win-core-featurestaging-l1-1-0 = ffi.load("api-ms-win-core-featurestaging-l1-1-0")
-- api-ms-win-core-featurestaging-l1-1-0.SubscribeFeatureStateChangeNotification(subscription, callback, context)
-- subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out
-- callback : PFEATURE_STATE_CHANGE_CALLBACK
-- context : void* optional
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('api-ms-win-core-featurestaging-l1-1-0.dll');
const SubscribeFeatureStateChangeNotification = lib.func('__stdcall', 'SubscribeFeatureStateChangeNotification', 'void', ['void *', 'void *', 'void *']);
// SubscribeFeatureStateChangeNotification(subscription, callback, context)
// subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out -> 'void *'
// callback : PFEATURE_STATE_CHANGE_CALLBACK -> 'void *'
// context : void* optional -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
// コールバック(関数ポインタ)は koffi.proto/koffi.register で型を定義して渡す(素の void* では JS 関数を渡せない)。
const lib = Deno.dlopen("api-ms-win-core-featurestaging-l1-1-0.dll", {
  SubscribeFeatureStateChangeNotification: { parameters: ["pointer", "pointer", "pointer"], result: "void" },
});
// lib.symbols.SubscribeFeatureStateChangeNotification(subscription, callback, context)
// subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out -> "pointer"
// callback : PFEATURE_STATE_CHANGE_CALLBACK -> "pointer"
// context : void* optional -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
void SubscribeFeatureStateChangeNotification(
    void* subscription,
    void* callback,
    void* context);
C, "api-ms-win-core-featurestaging-l1-1-0.dll");
// $ffi->SubscribeFeatureStateChangeNotification(subscription, callback, context);
// subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out
// callback : PFEATURE_STATE_CHANGE_CALLBACK
// context : void* optional
// 構造体/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-core-featurestaging-l1-1-0 extends StdCallLibrary {
    Api-ms-win-core-featurestaging-l1-1-0 INSTANCE = Native.load("api-ms-win-core-featurestaging-l1-1-0", Api-ms-win-core-featurestaging-l1-1-0.class);
    void SubscribeFeatureStateChangeNotification(
        Pointer subscription,   // FEATURE_STATE_CHANGE_SUBSCRIPTION* out
        Callback callback,   // PFEATURE_STATE_CHANGE_CALLBACK
        Pointer context   // void* optional
    );
}
@[Link("api-ms-win-core-featurestaging-l1-1-0")]
lib Libapi-ms-win-core-featurestaging-l1-1-0
  fun SubscribeFeatureStateChangeNotification = SubscribeFeatureStateChangeNotification(
    subscription : Void*,   # FEATURE_STATE_CHANGE_SUBSCRIPTION* out
    callback : Void*,   # PFEATURE_STATE_CHANGE_CALLBACK
    context : Void*   # void* optional
  ) : Void
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef SubscribeFeatureStateChangeNotificationNative = Void Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
typedef SubscribeFeatureStateChangeNotificationDart = void Function(Pointer<Void>, Pointer<Void>, Pointer<Void>);
final SubscribeFeatureStateChangeNotification = DynamicLibrary.open('api-ms-win-core-featurestaging-l1-1-0.dll')
    .lookupFunction<SubscribeFeatureStateChangeNotificationNative, SubscribeFeatureStateChangeNotificationDart>('SubscribeFeatureStateChangeNotification');
// subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out -> Pointer<Void>
// callback : PFEATURE_STATE_CHANGE_CALLBACK -> Pointer<Void>
// context : void* optional -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
procedure SubscribeFeatureStateChangeNotification(
  subscription: Pointer;   // FEATURE_STATE_CHANGE_SUBSCRIPTION* out
  callback: Pointer;   // PFEATURE_STATE_CHANGE_CALLBACK
  context: Pointer   // void* optional
); stdcall;
  external 'api-ms-win-core-featurestaging-l1-1-0.dll' name 'SubscribeFeatureStateChangeNotification';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "SubscribeFeatureStateChangeNotification"
  c_SubscribeFeatureStateChangeNotification :: Ptr () -> Ptr () -> Ptr () -> IO ()
-- subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out -> Ptr ()
-- callback : PFEATURE_STATE_CHANGE_CALLBACK -> Ptr ()
-- context : void* optional -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let subscribefeaturestatechangenotification =
  foreign "SubscribeFeatureStateChangeNotification"
    ((ptr void) @-> (ptr void) @-> (ptr void) @-> returning void)
(* subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out -> (ptr void) *)
(* callback : PFEATURE_STATE_CHANGE_CALLBACK -> (ptr void) *)
(* context : void* optional -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library api-ms-win-core-featurestaging-l1-1-0 (t "api-ms-win-core-featurestaging-l1-1-0.dll"))
(cffi:use-foreign-library api-ms-win-core-featurestaging-l1-1-0)

(cffi:defcfun ("SubscribeFeatureStateChangeNotification" subscribe-feature-state-change-notification :convention :stdcall) :void
  (subscription :pointer)   ; FEATURE_STATE_CHANGE_SUBSCRIPTION* out
  (callback :pointer)   ; PFEATURE_STATE_CHANGE_CALLBACK
  (context :pointer))   ; void* optional
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $SubscribeFeatureStateChangeNotification = Win32::API::More->new('api-ms-win-core-featurestaging-l1-1-0',
    'void SubscribeFeatureStateChangeNotification(HANDLE subscription, LPVOID callback, LPVOID context)');
# my $ret = $SubscribeFeatureStateChangeNotification->Call($subscription, $callback, $context);
# subscription : FEATURE_STATE_CHANGE_SUBSCRIPTION* out -> HANDLE
# callback : PFEATURE_STATE_CHANGE_CALLBACK -> LPVOID
# context : void* optional -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。
# コールバック(関数ポインタ)は Perl sub を直接渡せません。Win32::API::Callback を使用してください。

関連項目

使用する型