Kernel32LoadLibrary Method
Loads the specified module into the address space of the calling process.
The specified module may cause other modules to be loaded.
Namespace: DevCase.Win32.NativeMethodsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("Kernel32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
public static SafeModuleHandle LoadLibrary(
string fileName
)
<DllImportAttribute("Kernel32.dll", CharSet := CharSet.Auto, BestFitMapping := false,
ThrowOnUnmappableChar := true, SetLastError := true>]
Public Shared Function LoadLibrary (
fileName As String
) As SafeModuleHandle
Dim fileName As String
Dim returnValue As SafeModuleHandle
returnValue = Kernel32.LoadLibrary(fileName)
public:
[DllImportAttribute(L"Kernel32.dll", CharSet = CharSet::Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)]
static SafeModuleHandle^ LoadLibrary(
[InAttribute] String^ fileName
)
[<DllImportAttribute("Kernel32.dll", CharSet = CharSet.Auto, BestFitMapping = false,
ThrowOnUnmappableChar = true, SetLastError = true)>]
static member LoadLibrary :
fileName : string -> SafeModuleHandle
No code example is currently available or this language may not be supported.
- fileName String
-
The name of the module.
This can be either a library module (a .dll file) or an executable module (an .exe file).
The name specified is the file name of the module and is not related to the name stored in the library module itself,
as specified by the LIBRARY keyword in the module-definition (.def) file.
If the string specifies a full path, the function searches only that path for the module.
If the string specifies a relative path or a module name without a path,
the function uses a standard search strategy to find the module.
If the function cannot find the module, the function fails.
When specifying a path, be sure to use backslashes (\), not forward slashes (/).
If the string specifies a module name without a path and the file name extension is omitted,
the function appends the default library extension .dll to the module name.
To prevent the function from appending .dll to the module name,
include a trailing point character (.) in the module name string.
SafeModuleHandle
If the function succeeds, the return value is a handle to the module.
If the function fails, the return value is
Zero.
To get extended error information, call
GetLastWin32Error.