LPCTSTR
LPCTSTR is a typedef used in the Windows API as part of the TCHAR portability layer. The name stands for Long Pointer to a Constant TCHAR String. It represents a pointer to a null-terminated string of type TCHAR that is read-only (constant). The actual underlying character type depends on whether Unicode support is enabled: if UNICODE is defined, TCHAR is wchar_t and LPCTSTR becomes const wchar_t*; otherwise TCHAR is char and LPCTSTR becomes const char*. In both cases, the string is null-terminated and should not be modified through this pointer. LPCTSTR is often used in API declarations to allow the same code to compile with either ANSI or Unicode character sets. Its closest modern equivalents are LPCSTR (const char*) and LPCWSTR (const wchar_t*). The Windows header files typically declare functions using LPCTSTR with the TCHAR alias; example: int MessageBox(HWND hWnd, LPCTSTR lpText, LPCTSTR lpCaption, UINT uType); When constructing string literals, programmers commonly wrap them with the TEXT or _T macro, e.g., MessageBox(NULL, TEXT("Hello"), TEXT("Title"), MB_OK); In Unicode builds, LPCTSTR corresponds to a wide string pointer; in ANSI builds, to a narrow string pointer. The type is read-only, contrasting with LPTSTR, which is a pointer to a modifiable TCHAR string. Although usage has diminished in modern code in favor of explicit wchar_t or char types, LPCTSTR remains common in legacy Windows code and in APIs designed for TCHAR-compatibility.