Win32 API 日本語リファレンス
ホームStorage.FileSystem › GetNotificationResourceManager

GetNotificationResourceManager

関数
KTMリソースマネージャーからトランザクション通知を取得する。
DLLktmw32.dll呼出規約winapiSetLastErrorあり対応OSWindows Vista 以降

シグネチャ

// ktmw32.dll
#include <windows.h>

BOOL GetNotificationResourceManager(
    HANDLE ResourceManagerHandle,
    TRANSACTION_NOTIFICATION* TransactionNotification,
    DWORD NotificationLength,
    DWORD dwMilliseconds,
    DWORD* ReturnLength
);

パラメーター

名前方向
ResourceManagerHandleHANDLEin
TransactionNotificationTRANSACTION_NOTIFICATION*inout
NotificationLengthDWORDin
dwMillisecondsDWORDin
ReturnLengthDWORD*inout

戻り値の型: BOOL

各言語での呼び出し定義

// ktmw32.dll
#include <windows.h>

BOOL GetNotificationResourceManager(
    HANDLE ResourceManagerHandle,
    TRANSACTION_NOTIFICATION* TransactionNotification,
    DWORD NotificationLength,
    DWORD dwMilliseconds,
    DWORD* ReturnLength
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ktmw32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool GetNotificationResourceManager(
    IntPtr ResourceManagerHandle,   // HANDLE
    IntPtr TransactionNotification,   // TRANSACTION_NOTIFICATION* in/out
    uint NotificationLength,   // DWORD
    uint dwMilliseconds,   // DWORD
    ref uint ReturnLength   // DWORD* in/out
);
<DllImport("ktmw32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function GetNotificationResourceManager(
    ResourceManagerHandle As IntPtr,   ' HANDLE
    TransactionNotification As IntPtr,   ' TRANSACTION_NOTIFICATION* in/out
    NotificationLength As UInteger,   ' DWORD
    dwMilliseconds As UInteger,   ' DWORD
    ByRef ReturnLength As UInteger   ' DWORD* in/out
) As Boolean
End Function
' ResourceManagerHandle : HANDLE
' TransactionNotification : TRANSACTION_NOTIFICATION* in/out
' NotificationLength : DWORD
' dwMilliseconds : DWORD
' ReturnLength : DWORD* in/out
Declare PtrSafe Function GetNotificationResourceManager Lib "ktmw32" ( _
    ByVal ResourceManagerHandle As LongPtr, _
    ByVal TransactionNotification As LongPtr, _
    ByVal NotificationLength As Long, _
    ByVal dwMilliseconds As Long, _
    ByRef ReturnLength As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetNotificationResourceManager = ctypes.windll.ktmw32.GetNotificationResourceManager
GetNotificationResourceManager.restype = wintypes.BOOL
GetNotificationResourceManager.argtypes = [
    wintypes.HANDLE,  # ResourceManagerHandle : HANDLE
    ctypes.c_void_p,  # TransactionNotification : TRANSACTION_NOTIFICATION* in/out
    wintypes.DWORD,  # NotificationLength : DWORD
    wintypes.DWORD,  # dwMilliseconds : DWORD
    ctypes.POINTER(wintypes.DWORD),  # ReturnLength : DWORD* in/out
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('ktmw32.dll')
GetNotificationResourceManager = Fiddle::Function.new(
  lib['GetNotificationResourceManager'],
  [
    Fiddle::TYPE_VOIDP,  # ResourceManagerHandle : HANDLE
    Fiddle::TYPE_VOIDP,  # TransactionNotification : TRANSACTION_NOTIFICATION* in/out
    -Fiddle::TYPE_INT,  # NotificationLength : DWORD
    -Fiddle::TYPE_INT,  # dwMilliseconds : DWORD
    Fiddle::TYPE_VOIDP,  # ReturnLength : DWORD* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "ktmw32")]
extern "system" {
    fn GetNotificationResourceManager(
        ResourceManagerHandle: *mut core::ffi::c_void,  // HANDLE
        TransactionNotification: *mut TRANSACTION_NOTIFICATION,  // TRANSACTION_NOTIFICATION* in/out
        NotificationLength: u32,  // DWORD
        dwMilliseconds: u32,  // DWORD
        ReturnLength: *mut u32  // DWORD* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("ktmw32.dll", SetLastError = true)]
public static extern bool GetNotificationResourceManager(IntPtr ResourceManagerHandle, IntPtr TransactionNotification, uint NotificationLength, uint dwMilliseconds, ref uint ReturnLength);
"@
$api = Add-Type -MemberDefinition $sig -Name 'ktmw32_GetNotificationResourceManager' -Namespace Win32 -PassThru
# $api::GetNotificationResourceManager(ResourceManagerHandle, TransactionNotification, NotificationLength, dwMilliseconds, ReturnLength)
#uselib "ktmw32.dll"
#func global GetNotificationResourceManager "GetNotificationResourceManager" sptr, sptr, sptr, sptr, sptr
; GetNotificationResourceManager ResourceManagerHandle, varptr(TransactionNotification), NotificationLength, dwMilliseconds, varptr(ReturnLength)   ; 戻り値は stat
; ResourceManagerHandle : HANDLE -> "sptr"
; TransactionNotification : TRANSACTION_NOTIFICATION* in/out -> "sptr"
; NotificationLength : DWORD -> "sptr"
; dwMilliseconds : DWORD -> "sptr"
; ReturnLength : DWORD* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "ktmw32.dll"
#cfunc global GetNotificationResourceManager "GetNotificationResourceManager" sptr, var, int, int, var
; res = GetNotificationResourceManager(ResourceManagerHandle, TransactionNotification, NotificationLength, dwMilliseconds, ReturnLength)
; ResourceManagerHandle : HANDLE -> "sptr"
; TransactionNotification : TRANSACTION_NOTIFICATION* in/out -> "var"
; NotificationLength : DWORD -> "int"
; dwMilliseconds : DWORD -> "int"
; ReturnLength : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL GetNotificationResourceManager(HANDLE ResourceManagerHandle, TRANSACTION_NOTIFICATION* TransactionNotification, DWORD NotificationLength, DWORD dwMilliseconds, DWORD* ReturnLength)
#uselib "ktmw32.dll"
#cfunc global GetNotificationResourceManager "GetNotificationResourceManager" intptr, var, int, int, var
; res = GetNotificationResourceManager(ResourceManagerHandle, TransactionNotification, NotificationLength, dwMilliseconds, ReturnLength)
; ResourceManagerHandle : HANDLE -> "intptr"
; TransactionNotification : TRANSACTION_NOTIFICATION* in/out -> "var"
; NotificationLength : DWORD -> "int"
; dwMilliseconds : DWORD -> "int"
; ReturnLength : DWORD* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	ktmw32 = windows.NewLazySystemDLL("ktmw32.dll")
	procGetNotificationResourceManager = ktmw32.NewProc("GetNotificationResourceManager")
)

// ResourceManagerHandle (HANDLE), TransactionNotification (TRANSACTION_NOTIFICATION* in/out), NotificationLength (DWORD), dwMilliseconds (DWORD), ReturnLength (DWORD* in/out)
r1, _, err := procGetNotificationResourceManager.Call(
	uintptr(ResourceManagerHandle),
	uintptr(TransactionNotification),
	uintptr(NotificationLength),
	uintptr(dwMilliseconds),
	uintptr(ReturnLength),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function GetNotificationResourceManager(
  ResourceManagerHandle: THandle;   // HANDLE
  TransactionNotification: Pointer;   // TRANSACTION_NOTIFICATION* in/out
  NotificationLength: DWORD;   // DWORD
  dwMilliseconds: DWORD;   // DWORD
  ReturnLength: Pointer   // DWORD* in/out
): BOOL; stdcall;
  external 'ktmw32.dll' name 'GetNotificationResourceManager';
result := DllCall("ktmw32\GetNotificationResourceManager"
    , "Ptr", ResourceManagerHandle   ; HANDLE
    , "Ptr", TransactionNotification   ; TRANSACTION_NOTIFICATION* in/out
    , "UInt", NotificationLength   ; DWORD
    , "UInt", dwMilliseconds   ; DWORD
    , "Ptr", ReturnLength   ; DWORD* in/out
    , "Int")   ; return: BOOL
●GetNotificationResourceManager(ResourceManagerHandle, TransactionNotification, NotificationLength, dwMilliseconds, ReturnLength) = DLL("ktmw32.dll", "bool GetNotificationResourceManager(void*, void*, dword, dword, void*)")
# 呼び出し: GetNotificationResourceManager(ResourceManagerHandle, TransactionNotification, NotificationLength, dwMilliseconds, ReturnLength)
# ResourceManagerHandle : HANDLE -> "void*"
# TransactionNotification : TRANSACTION_NOTIFICATION* in/out -> "void*"
# NotificationLength : DWORD -> "dword"
# dwMilliseconds : DWORD -> "dword"
# ReturnLength : DWORD* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。