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