A version of this page is also available for
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.
int LoadString( HINSTANCE hInstance, UINT uID, LPTSTR lpBuffer, int cchBufferMax );
[in] Handle to an instance of the module whose executable file contains the string resource.
[in] Integer identifier of the string to be loaded.
[out] Long pointer to the buffer to receive the string.
[in] Size of the buffer in characters. The string is truncated and null terminated if it is longer than the number of characters specified.
The number of characters copied into the buffer, excluding the terminating null character, indicates success. Zero indicates that the string resource does not exist. To get extended error information, call GetLastError.
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.
String resources are not null-terminated by default. When lpBuffer is set to NULL, verify whether the string resource represented by the pointer returned by LoadString is null-terminated, and if necessary, append a terminating null character to the resource before using it in your application.
|Windows Embedded CE||Windows CE 1.0 and later|
|Windows Mobile||Windows Mobile Version 5.0 and later|