Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
This function returns a handle to a specified resource located in a dynamic-link library (DLL) or executable.
Syntax
HGLOBAL LoadResource( HMODULE hModule, HRSRC hResInfo ); |
Parameters
- hModule
-
Handle to the module whose executable file contains the resource. If hModuleis NULL, the system loads the resource from the module that was used to create the current process. In Windows CE 1.0 and 1.01, setting this parameter to NULL is not supported.
- hResInfo
-
Handle to the resource to be loaded. This handle must be created by using the FindResourcefunction.
Return Value
A handle to the data associated with the resource indicates success. NULL indicates failure. To get extended error information, call GetLastError.
Remarks
The return type of LoadResourceis HGLOBALfor backward compatibility, not because the function returns a handle to a global memory block. Always use LockResourceto convert the handle returned by LoadResourceinto a pointer.
The resources in an application, whether from an executable or a DLL, are always mapped to the address space of a process. LoadResourcesimply retrieves the address of the resource that is already in memory. LoadResourcedoes not allocate any additional memory. The pointer returned by LockResourceidentifies the address of the block of memory, in the executable or in the DLL, containing the specified resource. The system automatically deletes these resources when the process that loaded them terminates, or when FreeLibraryis used to unload a DLL that was loaded with LoadLibrary.
Requirements
Header | winbase.h |
Library | coredll.lib, Nk.lib |
Windows Embedded CE | Windows CE 1.0 and later |
Windows Mobile | Windows Mobile Version 5.0 and later |