Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

GetProcAddress

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

This function returns the address of the specified exported DLL function.


FARPROC GetProcAddress(
  HMODULE hModule,
  LPCWSTR lpProcName
);

hModule

[in] Handle to the DLL module that contains the function.

The LoadLibrary or the GetModuleHandle function returns this handle.

lpProcName

[in] Pointer to a null-terminated string containing the function name, or specifies 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.

This parameter must be in Unicode.

The address of the DLL's exported function indicates success. NULL indicates failure. To get extended error information, call GetLastError.

For Windows CE 3.0 and later, the ASCII version of this function, GetProcAddressA, is supported. With this version, lpProcName is of the type LPCSTR.

The GetProcAddress function is used to retrieve addresses of exported functions in DLLs.

The spelling and case of the function name pointed to by lpProcName must be identical to that in the EXPORTS statement of the source DLL's module-definition (.def) file.

The exported names of Win32 APIs might differ from the names you use when calling these functions in your code. This difference is hidden by macros used in the SDK header files.

The lpProcName parameter can identify the DLL function by specifying an ordinal value associated with the function in the EXPORTS statement.

GetProcAddress verifies that the specified ordinal is in the range 1 through the highest ordinal value exported in the .def file.

The function then uses the ordinal as an index to read the function's address from a function table.

If the .def file does not number the functions consecutively from 1 to N (where N is the number of exported functions), an error can occur where GetProcAddress returns an invalid, nonnull address, even though there is no function with the specified ordinal.

In cases where the function might not exist, the function should be specified by name rather than by ordinal value.

When using GetProcAddress to obtain the address of the InitSecurityInterface function, use SECURITY_ENTRYPOINT for lpProcName.

Headerwinbase.h
Librarycoredll.lib
Windows Embedded CEWindows CE 1.0 and later
Windows MobileWindows Mobile Version 5.0 and later

Community Additions

Show:
© 2015 Microsoft