How to interpret UIAutomation get_CurrentState parameter?

Leonardo 91 Reputation points
2022-08-18T06:59:06.31+00:00

Im using this code to get the value of LegacyIAccessible.State: show in the picture below:

IUIAutomationElement* element = nullptr;  
hr = elementArray->GetElement(nItem, &element);  
BSTR bstrName;  
hr = element->get_CurrentName(&bstrName);  
  
UIA_HWND hwnd;  
hr = element->get_CurrentNativeWindowHandle(&hwnd);  
  
BSTR bstrId;  
hr = element->get_CurrentAutomationId(&bstrId);  
RECT rect;  
hr = element->get_CurrentBoundingRectangle(&rect);  
  
IUIAutomationLegacyIAccessiblePattern* pattern;  
element->GetCurrentPatternAs(UIA_LegacyIAccessiblePatternId, IID_PPV_ARGS(&pattern));  
DWORD state = 0;  
pattern->get_CurrentState(&state);  

When the value of state is 1074790400 witch in hex represent 0x40100000

How i could interpret this value to get these values in the picture? i mean: focusable has popup (0x40100000).

232214-inspect-2022-08-18-03-52-55.png

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,412 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,519 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Castorix31 81,461 Reputation points
    2022-08-18T07:09:46.94+00:00

    In Oleacc.h :

    #define	STATE_SYSTEM_FOCUSABLE	( 0x100000 )  
      
    #define	STATE_SYSTEM_HASPOPUP	( 0x40000000 )  
    

  2. Xiaopo Yang - MSFT 11,256 Reputation points Microsoft Vendor
    2022-08-18T07:16:27.133+00:00

    According to LegacyIAccessible Control Pattern, Use the GetStateText function to retrieve localized string.

    0 comments No comments