Kernel32DisableThreadLibraryCalls Method

Disables the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications for the specified dynamic-link library (DLL). This can reduce the size of the working set for some applications.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", ExactSpelling = true, SetLastError = true)]
public static bool DisableThreadLibraryCalls(
	IntPtr hModule
)

Parameters

hModule  IntPtr
A handle to the DLL module for which the DLL_THREAD_ATTACH and DLL_THREAD_DETACH notifications are to be disabled.

The LoadLibrary(String), LoadLibraryEx(String, IntPtr, LoadLibraryFlags), or GetModuleHandle(String) function returns this handle.

Note that you cannot call GetModuleHandle(String) with because this returns the base address of the executable image, not the DLL image.

The DisableThreadLibraryCalls(IntPtr) function fails if the DLL specified by hModule has active static thread local storage, or if hModule is an invalid module handle.

Return Value

Boolean
If the function succeeds, the return value is .

If the function fails, the return value is .

To get extended error information, call GetLastWin32Error.

Remarks

See Also