Partager via


LoadString (Windows CE 5.0)

Send Feedback

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.

intLoadString(HINSTANCEhInstance, UINTuID, LPTSTRlpBuffer, intcchBufferMax );

Parameters

  • hInstance
    [in] Handle to an instance of the module whose executable file contains the string resource.
  • uID
    [in] The integer identifier of the string to be loaded.
  • lpBuffer
    [out] Long pointer to the buffer to receive the string.
  • cchBufferMax
    [in] 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, excluding 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.

Note   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.

Requirements

OS Versions: Windows CE 1.0 and later.
Header: Winbase.h.
Link Library: Loadstr.lib.

See Also

LoadAccelerators | LoadBitmap | LoadIcon | LoadMenu | Programming with Unicode and NLS

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.