LockResource function
Retrieves a pointer to the specified resource in memory.
Syntax
LPVOID WINAPI LockResource( _In_ HGLOBAL hResData );
Parameters
- hResData [in]
-
Type: HGLOBAL
A handle to the resource to be accessed. The LoadResource function returns this handle. Note that this parameter is listed as an HGLOBAL variable only for backward compatibility. Do not pass any value as a parameter other than a successful return value from the LoadResource function.
Return value
Type: LPVOID
If the loaded resource is available, the return value is a pointer to the first byte of the resource; otherwise, it is NULL.
Remarks
The pointer returned by LockResource is valid until the module containing the resource is unloaded. It is not necessary to unlock resources because the system automatically deletes them when the process that created them terminates.
Do not try to lock a resource by using the handle returned by the FindResource or FindResourceEx function. Such a handle points to random data.
Examples
For an example, see Updating Resources.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Reference
- FindResource
- FindResourceEx
- LoadResource
- Conceptual
- Resources