LoadResource (Windows CE 5.0)

Send Feedback

This function returns a handle to a specified resource located in a dynamic-link library (DLL) or executable.

HGLOBALLoadResource( HMODULEhModule, HRSRChResInfo );

Parameters

  • hModule
    Handle to the module whose executable file contains the resource. If hModule is 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 FindResource function.

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 LoadResource is HGLOBAL for backward compatibility, not because the function returns a handle to a global memory block. Always use LockResource to convert the handle returned by LoadResource into a pointer.

The resources in an application, whether from an executable or a DLL, are always mapped to the address space of a process. LoadResource simply retrieves the address of the resource that is already in memory. LoadResource does not allocate any additional memory. The pointer returned by LockResource identifies 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 FreeLibrary is used to unload a DLL that was loaded with LoadLibrary.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Winbase.h.
Link Library: Coredll.lib, Nk.lib

See Also

FindResource | LoadLibrary | FreeLibrary | LockResource | Using Resources

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.