GetStateText

The GetStateText function retrieves a localized string that describes an object's state for a single predefined state bit flag. Because state values are a combination of one or more bit flags, clients call this function more than once to retrieve all the state strings.

UINT GetStateText(
DWORDdwStateBit,LPTSTRlpszStateBit,UINTcchStateBitMax);

Parameters

  • dwStateBit
    [in] One of the object state constants.
  • lpszStateBit
    [out] Address of a buffer that receives the state text string. If this parameter is NULL, the function returns the state string's length, not including the null character.
  • cchStateBitMax
    [in] The size of the buffer pointed to by the lpszStateBit parameter. For ANSI strings, this value is measured in bytes. For Unicode strings, it is measured in characters.

Return Values

If successful, and lpszStateBit is non-NULL, the return value is the number of bytes (ANSI version) or characters (Unicode version) copied into the buffer, not including the null-terminated character. If lpszStateBit is NULL, then the return value represents the string's length, not including the null character.

If the string resource does not exist, or if the lpszStateBit parameter is not a valid pointer, the return value is zero (0). To get extended error information, call GetLastError.

Remarks

This function accepts only one state bit at a time, not a bitmask.

Example

See the client example at IAccessible::get_accState.

Requirements

**  Windows NT/2000/XP/Server 2003:** Included in Windows 2000 and later.
**  Windows 95/98/Me:** Included in Windows 98 and later.
**  Redistributable:** Requires Active Accessibility 1.3 RDK on Windows NT 4.0 SP6 and Windows 95.
**  Header:** Declared in Oleacc.h.
**  Library:** Use Oleacc.lib.
**  Unicode:** Implemented as Unicode and ANSI versions on Windows NT/2000/XP/Server 2003.