次の方法で共有


LoadResource (Windows Embedded CE 6.0)

1/6/2010

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

Header winbase.h
Library coredll.lib, Nk.lib
Windows Embedded CE Windows CE 1.0 and later

See Also

Reference

Resources Functions
FindResource
LockResource

Concepts

Using Resources

Other Resources

LoadLibrary
FreeLibrary