Kernel32GetProcAddress(IntPtr, String) Method

Retrieves the address of an exported function or variable from the specified dynamic-link library (DLL).

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", BestFitMapping = false, ExactSpelling = true, 
	ThrowOnUnmappableChar = true, SetLastError = true)]
public static IntPtr GetProcAddress(
	IntPtr hModule,
	string procName
)

Parameters

hModule  IntPtr
A handle to the DLL module that contains the function or variable.

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

The GetProcAddress(SafeModuleHandle, String) function does not retrieve addresses from modules that were loaded using the LoadLibraryAsDataFile flag.

procName  String
The function or variable name, or the function's ordinal value.

If this parameter is an ordinal value, it must be in the low-order word; the high-order word must be zero.

Return Value

IntPtr
If the function succeeds, the return value is the address of the exported function or variable.

If the function fails, the return value is Zero.

To get extended error information, call GetLastWin32Error.

Remarks

See Also