This function loads a string resource from the executable file associated with a specified module, copies the string into a buffer, and appends a terminating null character.
At a Glance
Header file: | Winuser.h |
Windows CE versions: | 1.0 and later |
Syntax
int LoadString(HINSTANCE hInstance, UINT uID, LPTSTR lpBuffer,
int nBufferMax);
Parameters
hInstance
[in] Handle to an instance of the module whose executable file contains the string resource.
uID
[in] Specifies the integer identifier of the string to be loaded.
lpBuffer
[out] Long pointer to the buffer to receive the string.
nBufferMax
[in] Specifies the size of the buffer in bytes (ANSI version) or characters (Unicode version). The string is truncated and null terminated if it is longer than the number of characters specified.
Return Values
The number of characters copied into the buffer, not including the terminating null character, indicates success. Zero indicates that the string resource does not exist. To get extended error information, call GetLastError.
Remarks
If lpBuffer is set to NULL, the return value is a pointer to the requested string. The caller should cast the return value to an LPCTSTR. This pointer points directly to the resource, so the string is read-only. The length of the string, not including any Terminating null character, can be found in the word preceding the string.
To use the lpBuffer pointer, the –n flag must be set with the resource compiler, RC.
See Also