Kernel32GetProcAddress(IntPtr, String) Method
Retrieves the address of an exported function or variable from the specified dynamic-link library (DLL).
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", BestFitMapping = false, ExactSpelling = true,
ThrowOnUnmappableChar = true, SetLastError = true)]
public static IntPtr GetProcAddress(
IntPtr hModule,
string procName
)
<DllImportAttribute("Kernel32.dll", BestFitMapping := false, ExactSpelling := true,
ThrowOnUnmappableChar := true, SetLastError := true>]
Public Shared Function GetProcAddress (
hModule As IntPtr,
procName As String
) As IntPtr
Dim hModule As IntPtr
Dim procName As String
Dim returnValue As IntPtr
returnValue = Kernel32.GetProcAddress(hModule,
procName)
public:
[DllImportAttribute(L"Kernel32.dll", BestFitMapping = false, ExactSpelling = true,
ThrowOnUnmappableChar = true, SetLastError = true)]
static IntPtr GetProcAddress(
IntPtr hModule,
String^ procName
)
[<DllImportAttribute("Kernel32.dll", BestFitMapping = false, ExactSpelling = true,
ThrowOnUnmappableChar = true, SetLastError = true)>]
static member GetProcAddress :
hModule : IntPtr *
procName : string -> IntPtr
No code example is currently available or this language may not be supported.
- 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.
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.