LPSTR LockResource(hResData)
This function retrieves the absolute memory address of the loaded resource identified by the hResData parameter. The resource is locked in memory and the given address and its reference count are increased by one. The locked resource is not subject to moving or discarding.
The resource remains locked in memory until its reference count is decreased to zero through calls to the FreeResource function.
If the resource identified by hResData has been discarded, the resource-handler function (if any) associated with the resource is called before the LockResource function returns. The resource-handler function can recalculate and reload the resource if desired. After the resource-handler function returns, LockResource makes another attempt to lock the resource and returns with the result.
Parameter | Type/Description |
hResData | HANDLE Identifies the desired resource. This handle is assumed to have been created by using the LoadResource function. |
The return value points to the first byte of the loaded resource if the resource was locked. Otherwise, it is NULL.
Using the handle returned by the FindResource function for the hResData parameter causes an error.
Use the UnlockResource macro to unlock a resource that was locked by using
LockResource.