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

RoUnregisterForApartmentShutdown

関数
アパートメント終了通知の登録を解除する。
DLLapi-ms-win-core-winrt-l1-1-0.dll呼出規約winapi対応OSwindows8.0

シグネチャ

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

HRESULT RoUnregisterForApartmentShutdown(
    APARTMENT_SHUTDOWN_REGISTRATION_COOKIE regCookie
);

パラメーター

名前方向
regCookieAPARTMENT_SHUTDOWN_REGISTRATION_COOKIEin

戻り値の型: 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   // HRESULT
function 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)。