lstrlenW function (winbase.h)

Determines the length of the specified string (not including the terminating null character).

Syntax

int lstrlenW(
  [in] LPCWSTR lpString
);

Parameters

[in] lpString

Type: LPCTSTR

The null-terminated string to be checked.

Return value

Type: int

The function returns the length of the string, in characters. If lpString is NULL, the function returns 0.

Remarks

Note

The winbase.h header defines lstrlen as an alias that automatically selects the ANSI or Unicode version of this function based on the definition of the UNICODE preprocessor constant. Mixing usage of the encoding-neutral alias with code that is not encoding-neutral can lead to mismatches that result in compilation or runtime errors. For more information, see Conventions for Function Prototypes.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winbase.h (include Windows.h)
Library Kernel32.lib
DLL Kernel32.dll

See also

Conceptual

Reference

StringCbLength

StringCchLength

Strings

lstrcat

lstrcmp

lstrcmpi

lstrcpy