ホーム › Storage.FileSystem › RegisterForLogWriteNotification
RegisterForLogWriteNotification
関数CLFSログ書き込みしきい値通知の登録を設定する。
シグネチャ
// clfsw32.dll
#include <windows.h>
BOOL RegisterForLogWriteNotification(
HANDLE hLog,
DWORD cbThreshold,
BOOL fEnable
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hLog | HANDLE | in |
| cbThreshold | DWORD | in |
| fEnable | BOOL | in |
戻り値の型: BOOL
各言語での呼び出し定義
// clfsw32.dll
#include <windows.h>
BOOL RegisterForLogWriteNotification(
HANDLE hLog,
DWORD cbThreshold,
BOOL fEnable
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("clfsw32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool RegisterForLogWriteNotification(
IntPtr hLog, // HANDLE
uint cbThreshold, // DWORD
bool fEnable // BOOL
);<DllImport("clfsw32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function RegisterForLogWriteNotification(
hLog As IntPtr, ' HANDLE
cbThreshold As UInteger, ' DWORD
fEnable As Boolean ' BOOL
) As Boolean
End Function' hLog : HANDLE
' cbThreshold : DWORD
' fEnable : BOOL
Declare PtrSafe Function RegisterForLogWriteNotification Lib "clfsw32" ( _
ByVal hLog As LongPtr, _
ByVal cbThreshold As Long, _
ByVal fEnable As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
RegisterForLogWriteNotification = ctypes.windll.clfsw32.RegisterForLogWriteNotification
RegisterForLogWriteNotification.restype = wintypes.BOOL
RegisterForLogWriteNotification.argtypes = [
wintypes.HANDLE, # hLog : HANDLE
wintypes.DWORD, # cbThreshold : DWORD
wintypes.BOOL, # fEnable : BOOL
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('clfsw32.dll')
RegisterForLogWriteNotification = Fiddle::Function.new(
lib['RegisterForLogWriteNotification'],
[
Fiddle::TYPE_VOIDP, # hLog : HANDLE
-Fiddle::TYPE_INT, # cbThreshold : DWORD
Fiddle::TYPE_INT, # fEnable : BOOL
],
Fiddle::TYPE_INT)#[link(name = "clfsw32")]
extern "system" {
fn RegisterForLogWriteNotification(
hLog: *mut core::ffi::c_void, // HANDLE
cbThreshold: u32, // DWORD
fEnable: i32 // BOOL
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("clfsw32.dll", SetLastError = true)]
public static extern bool RegisterForLogWriteNotification(IntPtr hLog, uint cbThreshold, bool fEnable);
"@
$api = Add-Type -MemberDefinition $sig -Name 'clfsw32_RegisterForLogWriteNotification' -Namespace Win32 -PassThru
# $api::RegisterForLogWriteNotification(hLog, cbThreshold, fEnable)#uselib "clfsw32.dll"
#func global RegisterForLogWriteNotification "RegisterForLogWriteNotification" sptr, sptr, sptr
; RegisterForLogWriteNotification hLog, cbThreshold, fEnable ; 戻り値は stat
; hLog : HANDLE -> "sptr"
; cbThreshold : DWORD -> "sptr"
; fEnable : BOOL -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "clfsw32.dll"
#cfunc global RegisterForLogWriteNotification "RegisterForLogWriteNotification" sptr, int, int
; res = RegisterForLogWriteNotification(hLog, cbThreshold, fEnable)
; hLog : HANDLE -> "sptr"
; cbThreshold : DWORD -> "int"
; fEnable : BOOL -> "int"; BOOL RegisterForLogWriteNotification(HANDLE hLog, DWORD cbThreshold, BOOL fEnable)
#uselib "clfsw32.dll"
#cfunc global RegisterForLogWriteNotification "RegisterForLogWriteNotification" intptr, int, int
; res = RegisterForLogWriteNotification(hLog, cbThreshold, fEnable)
; hLog : HANDLE -> "intptr"
; cbThreshold : DWORD -> "int"
; fEnable : BOOL -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
clfsw32 = windows.NewLazySystemDLL("clfsw32.dll")
procRegisterForLogWriteNotification = clfsw32.NewProc("RegisterForLogWriteNotification")
)
// hLog (HANDLE), cbThreshold (DWORD), fEnable (BOOL)
r1, _, err := procRegisterForLogWriteNotification.Call(
uintptr(hLog),
uintptr(cbThreshold),
uintptr(fEnable),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction RegisterForLogWriteNotification(
hLog: THandle; // HANDLE
cbThreshold: DWORD; // DWORD
fEnable: BOOL // BOOL
): BOOL; stdcall;
external 'clfsw32.dll' name 'RegisterForLogWriteNotification';result := DllCall("clfsw32\RegisterForLogWriteNotification"
, "Ptr", hLog ; HANDLE
, "UInt", cbThreshold ; DWORD
, "Int", fEnable ; BOOL
, "Int") ; return: BOOL●RegisterForLogWriteNotification(hLog, cbThreshold, fEnable) = DLL("clfsw32.dll", "bool RegisterForLogWriteNotification(void*, dword, bool)")
# 呼び出し: RegisterForLogWriteNotification(hLog, cbThreshold, fEnable)
# hLog : HANDLE -> "void*"
# cbThreshold : DWORD -> "dword"
# fEnable : BOOL -> "bool"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。