Quantcast
Channel: Windows Desktop Development for Accessibility and Automation forum
Viewing all articles
Browse latest Browse all 585

Native UIA BoundingRectangle property value not matching my desktop resolution

$
0
0

Hi, guys

I found UIA BoundingRectangle property value is not correct in latest win os.

I wrote a test app to print desktop's BoundingRectangle, result on OS 9860 is 1536x864, but actual resolution is 1920x1080.

Any idea?

Here is the code, pretty simple:

	CoInitialize(NULL);

	IUIAutomation2* _pUIAutomation = NULL;
	CoCreateInstance(CLSID_CUIAutomation8, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&_pUIAutomation));

	IUIAutomationElement* rootElement = NULL;
	_pUIAutomation->GetRootElement(&rootElement);

	//use get_CurrentBoundingRectangle
	RECT rectBoundingRectangle;
	rootElement->get_CurrentBoundingRectangle(&rectBoundingRectangle);
	printf("[get_CurrentBoundingRectangle] left: %d, top: %d, right: %d, bottom:%d\n",
		rectBoundingRectangle.left, rectBoundingRectangle.top, rectBoundingRectangle.right, rectBoundingRectangle.bottom);

	//use GetCurrentPropertyValue
	VARIANT boundingRectangle;
	RECT rectBoundingRectangle2;
	VariantInit(&boundingRectangle);
	rootElement->GetCurrentPropertyValue(UIA_BoundingRectanglePropertyId, &boundingRectangle);
	_pUIAutomation->VariantToRect(boundingRectangle, &rectBoundingRectangle2);

	printf("[GetCurrentPropertyValue] left: %d, top: %d, right: %d, bottom:%d\n",
		rectBoundingRectangle.left, rectBoundingRectangle.top, rectBoundingRectangle.right, rectBoundingRectangle.bottom);

	VariantClear(&boundingRectangle);

Update:

I found Inspect.exe can get the correct BoundingRectangle, this is wired, because Inpect.exe is also using native UIA. 

Here is the screenshot:

Update2:

When I uninstall the Intel Graphic driver and using MS Basic display driver, My test app can get the correct BoundingRectangle value. But I want it work with Intel Graphic driver. Since Inspect.exe can get the right value with Intel driver, I think there should be some way to walk around this issue.

Any suggestion is welcome, and anyone know where I can get the source code of Inpect.exe, so I can found out how Inpect.exe handle this issue.


Viewing all articles
Browse latest Browse all 585

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>