[This is preliminary documentation and subject to change.]
Retrieves the localized standard adjective string for a single standard state bit.
UINT GetStateText(
DWORD dwStateBit,
LPTSTR lpszStateBit,
UINT cchStateBitMax
);
Returns the number of characters copied to the string. If the lpszStateBit parameter is NULL, then the return value is the string's length, not including the null character.
This function accepts only one bit at a time, not a bitmask.
If the lpszRole parameter is not a valid pointer, the function returns zero and sets an ERROR_INVALID_PARAMETER error value. Applications can retrieve this error value with the GetLastError Win32 function.
Calling this function with lpszStateBit set to NULL is analogous to querying for the length of the state text string. You can use the return value from such a call to dynamically allocate the memory needed to hold the string. The following code fragment illustrates this concept.
UINT iLength;
LPTSTR lpszString;
// Find out how long the string is.
iLength = GetStateText(STATE_SYSTEM_FOCUSED, NULL, 0);
// Allocate memory for the string. Add one byte to
// length we got in the previous call to make room
// for the null character.
lpszString = GlobalAllocPtr(GMEM_FIXED, iLength + 1);
// Get the string.
GetStateText(STATE_SYSTEM_FOCUSED, lpszString, iLength + 1);