ホーム › System.WinRT › RoUnregisterForApartmentShutdown
RoUnregisterForApartmentShutdown
関数アパートメント終了通知の登録を解除する。
シグネチャ
// api-ms-win-core-winrt-l1-1-0.dll
#include <windows.h>
HRESULT RoUnregisterForApartmentShutdown(
APARTMENT_SHUTDOWN_REGISTRATION_COOKIE regCookie
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| regCookie | APARTMENT_SHUTDOWN_REGISTRATION_COOKIE | in | 登録時に取得したアパートメント終了通知解除用のCOOKIE。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// api-ms-win-core-winrt-l1-1-0.dll
#include <windows.h>
HRESULT RoUnregisterForApartmentShutdown(
APARTMENT_SHUTDOWN_REGISTRATION_COOKIE regCookie
);[DllImport("api-ms-win-core-winrt-l1-1-0.dll", ExactSpelling = true)]
static extern int RoUnregisterForApartmentShutdown(
IntPtr regCookie // APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
);<DllImport("api-ms-win-core-winrt-l1-1-0.dll", ExactSpelling:=True)>
Public Shared Function RoUnregisterForApartmentShutdown(
regCookie As IntPtr ' APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
) As Integer
End Function' regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
Declare PtrSafe Function RoUnregisterForApartmentShutdown Lib "api-ms-win-core-winrt-l1-1-0" ( _
ByVal regCookie As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RoUnregisterForApartmentShutdown = ctypes.windll.LoadLibrary("api-ms-win-core-winrt-l1-1-0.dll").RoUnregisterForApartmentShutdown
RoUnregisterForApartmentShutdown.restype = ctypes.c_int
RoUnregisterForApartmentShutdown.argtypes = [
wintypes.HANDLE, # regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('api-ms-win-core-winrt-l1-1-0.dll')
RoUnregisterForApartmentShutdown = Fiddle::Function.new(
lib['RoUnregisterForApartmentShutdown'],
[
Fiddle::TYPE_VOIDP, # regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
],
Fiddle::TYPE_INT)#[link(name = "api-ms-win-core-winrt-l1-1-0")]
extern "system" {
fn RoUnregisterForApartmentShutdown(
regCookie: *mut core::ffi::c_void // APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("api-ms-win-core-winrt-l1-1-0.dll")]
public static extern int RoUnregisterForApartmentShutdown(IntPtr regCookie);
"@
$api = Add-Type -MemberDefinition $sig -Name 'api-ms-win-core-winrt-l1-1-0_RoUnregisterForApartmentShutdown' -Namespace Win32 -PassThru
# $api::RoUnregisterForApartmentShutdown(regCookie)#uselib "api-ms-win-core-winrt-l1-1-0.dll"
#func global RoUnregisterForApartmentShutdown "RoUnregisterForApartmentShutdown" sptr
; RoUnregisterForApartmentShutdown regCookie ; 戻り値は stat
; regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "api-ms-win-core-winrt-l1-1-0.dll"
#cfunc global RoUnregisterForApartmentShutdown "RoUnregisterForApartmentShutdown" sptr
; res = RoUnregisterForApartmentShutdown(regCookie)
; regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE -> "sptr"; HRESULT RoUnregisterForApartmentShutdown(APARTMENT_SHUTDOWN_REGISTRATION_COOKIE regCookie)
#uselib "api-ms-win-core-winrt-l1-1-0.dll"
#cfunc global RoUnregisterForApartmentShutdown "RoUnregisterForApartmentShutdown" intptr
; res = RoUnregisterForApartmentShutdown(regCookie)
; regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
api_ms_win_core_winrt_l1_1_0 = windows.NewLazySystemDLL("api-ms-win-core-winrt-l1-1-0.dll")
procRoUnregisterForApartmentShutdown = api_ms_win_core_winrt_l1_1_0.NewProc("RoUnregisterForApartmentShutdown")
)
// regCookie (APARTMENT_SHUTDOWN_REGISTRATION_COOKIE)
r1, _, err := procRoUnregisterForApartmentShutdown.Call(
uintptr(regCookie),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction RoUnregisterForApartmentShutdown(
regCookie: THandle // APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
): Integer; stdcall;
external 'api-ms-win-core-winrt-l1-1-0.dll' name 'RoUnregisterForApartmentShutdown';result := DllCall("api-ms-win-core-winrt-l1-1-0\RoUnregisterForApartmentShutdown"
, "Ptr", regCookie ; APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
, "Int") ; return: HRESULT●RoUnregisterForApartmentShutdown(regCookie) = DLL("api-ms-win-core-winrt-l1-1-0.dll", "int RoUnregisterForApartmentShutdown(void*)")
# 呼び出し: RoUnregisterForApartmentShutdown(regCookie)
# regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "api-ms-win-core-winrt-l1-1-0" fn RoUnregisterForApartmentShutdown(
regCookie: ?*anyopaque // APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
) callconv(std.os.windows.WINAPI) i32;proc RoUnregisterForApartmentShutdown(
regCookie: pointer # APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
): int32 {.importc: "RoUnregisterForApartmentShutdown", stdcall, dynlib: "api-ms-win-core-winrt-l1-1-0.dll".}pragma(lib, "api-ms-win-core-winrt-l1-1-0");
extern(Windows)
int RoUnregisterForApartmentShutdown(
void* regCookie // APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
);ccall((:RoUnregisterForApartmentShutdown, "api-ms-win-core-winrt-l1-1-0.dll"), stdcall, Int32,
(Ptr{Cvoid},),
regCookie)
# regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t RoUnregisterForApartmentShutdown(
void* regCookie);
]]
local api-ms-win-core-winrt-l1-1-0 = ffi.load("api-ms-win-core-winrt-l1-1-0")
-- api-ms-win-core-winrt-l1-1-0.RoUnregisterForApartmentShutdown(regCookie)
-- regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('api-ms-win-core-winrt-l1-1-0.dll');
const RoUnregisterForApartmentShutdown = lib.func('__stdcall', 'RoUnregisterForApartmentShutdown', 'int32_t', ['void *']);
// RoUnregisterForApartmentShutdown(regCookie)
// regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("api-ms-win-core-winrt-l1-1-0.dll", {
RoUnregisterForApartmentShutdown: { parameters: ["pointer"], result: "i32" },
});
// lib.symbols.RoUnregisterForApartmentShutdown(regCookie)
// regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t RoUnregisterForApartmentShutdown(
void* regCookie);
C, "api-ms-win-core-winrt-l1-1-0.dll");
// $ffi->RoUnregisterForApartmentShutdown(regCookie);
// regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
// 構造体/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-winrt-l1-1-0 extends StdCallLibrary {
Api-ms-win-core-winrt-l1-1-0 INSTANCE = Native.load("api-ms-win-core-winrt-l1-1-0", Api-ms-win-core-winrt-l1-1-0.class);
int RoUnregisterForApartmentShutdown(
Pointer regCookie // APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
);
}@[Link("api-ms-win-core-winrt-l1-1-0")]
lib Libapi-ms-win-core-winrt-l1-1-0
fun RoUnregisterForApartmentShutdown = RoUnregisterForApartmentShutdown(
regCookie : Void* # APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef RoUnregisterForApartmentShutdownNative = Int32 Function(Pointer<Void>);
typedef RoUnregisterForApartmentShutdownDart = int Function(Pointer<Void>);
final RoUnregisterForApartmentShutdown = DynamicLibrary.open('api-ms-win-core-winrt-l1-1-0.dll')
.lookupFunction<RoUnregisterForApartmentShutdownNative, RoUnregisterForApartmentShutdownDart>('RoUnregisterForApartmentShutdown');
// regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function RoUnregisterForApartmentShutdown(
regCookie: THandle // APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
): Integer; stdcall;
external 'api-ms-win-core-winrt-l1-1-0.dll' name 'RoUnregisterForApartmentShutdown';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "RoUnregisterForApartmentShutdown"
c_RoUnregisterForApartmentShutdown :: Ptr () -> IO Int32
-- regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let rounregisterforapartmentshutdown =
foreign "RoUnregisterForApartmentShutdown"
((ptr void) @-> returning int32_t)
(* regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library api-ms-win-core-winrt-l1-1-0 (t "api-ms-win-core-winrt-l1-1-0.dll"))
(cffi:use-foreign-library api-ms-win-core-winrt-l1-1-0)
(cffi:defcfun ("RoUnregisterForApartmentShutdown" ro-unregister-for-apartment-shutdown :convention :stdcall) :int32
(reg-cookie :pointer)) ; APARTMENT_SHUTDOWN_REGISTRATION_COOKIE
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $RoUnregisterForApartmentShutdown = Win32::API::More->new('api-ms-win-core-winrt-l1-1-0',
'int RoUnregisterForApartmentShutdown(HANDLE regCookie)');
# my $ret = $RoUnregisterForApartmentShutdown->Call($regCookie);
# regCookie : APARTMENT_SHUTDOWN_REGISTRATION_COOKIE -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。