Microsoft Windows CE 3.0  

LoadResource

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 loads the specified resource into global memory.

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 versions 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 Values

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.

When you are finished using a bitmap, cursor, icon, or menu, you can release its associated memory by calling one of the functions in the following table.

Resource Release function
Bitmap DeleteObject
Cursor DestroyCursor
Icon DestroyIcon
Menu DestroyMenu

The system automatically deletes these resources when the process that loaded them terminates, however, calling the appropriate function saves memory and decreases the size of the process's working set.

Accelerator tables are an exception. They remain in memory until the process terminates.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winbase.h   Coredll.lib, Nk.lib
Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

DeleteObject, DestroyCursor, DestroyIcon, DestroyMenu, FindResource, GetLastError, LoadLibrary