CPackage::LoadResource

The CPackage::LoadResource function loads resource metadata from the specified package.

BOOL LoadResource(
UINT uID, // resource ID
UINT FAR *lpuType, // resource type
LPVOID lpvData, // resource data buffer
LPDWORD lpcbData // buffer size
);

Parameters

uID
[in] An unsigned integer which identifies the resource to be loaded.
 
lpuType
[out] A pointer to an unsigned integer that will receive the resource type. This parameter may be NULL if the caller does not require the type information.
 
One of the following values may be returned:
Value Description
PACKAGE_RESOURCE_BINARY This resource contains a block of binary data. The format and type of data are application specific.
PACKAGE_RESOURCE_TEXT This resource contains a block of text. The text is not null terminated. This resource type is primarily used for text files.
PACKAGE_RESOURCE_STRING This resource is a string and is terminated with a null-byte.
lpvData
[out] A pointer to a buffer that will receive the resource data. This parameter may be NULL if the caller does not require the data.
 
lpcbData
[in/out] A pointer to a DWORD which specifies the length of the buffer specified by lpvData. This value will be updated with the actual length of the resource when the function returns. If the lpvData parameter is NULL and the resource exists, the function will return a non-zero value and the lpcbData parameter will contain the length of the resource. If the lpvData parameter is not NULL and the buffer is not large enough to store the resource data, this function will return a zero value with the last error set to AP_ERROR_BUFFER_TOO_SMALL.

Return Values

If the CPackage::LoadResource function succeeds, it will return a non-zero value.

If the function fails, it will return a value of zero. To get extended error information, call GetLastError.

Remarks

Valid resource IDs are in the range of 0000h - EFFFh. Values outside of this range are reserved for internal use and will result in an error.

The maximum size of any one package resource is approximately 2 billion bytes.

Requirements

Windows NT/2000/XP: Requires Windows NT 4.0 SP3 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Include apatch.h.
Library: Use apatch32.lib.

See Also

CPackage::StoreResource