Share via


LoadString

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 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 characters. 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, 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.

Requirements

Runs on Versions Defined in Include Link to
Windows CE OS 1.0 and later Winbase.h   Loadstr.lib

Note   This API is part of the complete Windows CE OS package as provided by Microsoft. The functionality of a particular platform is determined by the original equipment manufacturer (OEM) and some devices may not support this API.

See Also

LoadAccelerators, LoadBitmap, LoadIcon, LoadMenu

 Last updated on Tuesday, July 13, 2004

© 1992-2000 Microsoft Corporation. All rights reserved.