Quantcast
Viewing all 585 articles
Browse latest View live

MSFlexGrid UIAutomation C++ API

Hello, 

I am building a Test Automation Tool for testing an old VB6 Windows Desktop application containing instances of MSFlexGrid. I am using the Client UIAutomation C++ API on Windows 7 and Visual Studio 2015.

The VB6 target application does not implement any Server UIAutomation feature. Despite that, I can successfully communicate with UI components (like Text field, Combo box, Check box) and I can get and set values on them.

But, I could not find any way to manage MSFlexGrid (i.e., reading the content of the grid). These are the details for an instance of MSFlexGrid from the Inspect tool:

************************************************************************************

hwnd=0x00000000000609AA 32bit class="MSFlexGridWndClass" style=0x54B00000 ex=0x200
RuntimeId:"[42.395690]"
BoundingRectangle:{l:572 t:251 r:1360 b:651}
ProcessId:4492
ControlType:UIA_PaneControlTypeId (0xC371)
LocalizedControlType:"pane"
Name:""
AccessKey:""
HasKeyboardFocus:true
IsKeyboardFocusable:true
IsEnabled:true
ClassName:"MSFlexGridWndClass"
HelpText:""
IsPassword:false
NativeWindowHandle:0x609AA
IsOffscreen:false
FrameworkId:"Win32"
ProviderDescription:"[pid:14012,hwnd:0x609AA Main:Nested [pid:4492,hwnd:0x609AA Annotation(parent link):Microsoft: Annotation Proxy (unmanaged:uiautomationcore.dll); Main:Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]; Nonclient:Microsoft: Non-Client Proxy (unmanaged:uiautomationcore.dll); Hwnd(parent link):Microsoft: HWND Proxy (unmanaged:uiautomationcore.dll)]"
Scroll.HorizontalScrollPercent:0.000000
Scroll.HorizontalViewSize:50.000000
Scroll.VerticalScrollPercent:66.666667
Scroll.VerticalViewSize:14.285714
Scroll.HorizontallyScrollable:true
Scroll.VerticallyScrollable:true
IsDockPatternAvailable:false
IsExpandCollapsePatternAvailable:false
IsGridItemPatternAvailable:false
IsGridPatternAvailable:false
IsInvokePatternAvailable:false
IsMultipleViewPatternAvailable:false
IsRangeValuePatternAvailable:false
IsScrollPatternAvailable:true
IsScrollItemPatternAvailable:false
IsSelectionItemPatternAvailable:false
IsSelectionPatternAvailable:false
IsTablePatternAvailable:false
IsTableItemPatternAvailable:false
IsTextPatternAvailable:false
IsTogglePatternAvailable:false
IsTransformPatternAvailable:false
IsValuePatternAvailable:false
IsWindowPatternAvailable:false
IsItemContainerPatternAvailable:false
IsVirtualizedItemPatternAvailable:false
FirstChild:"Vertical" scroll bar
LastChild:(null) thumb
Next:[null]
Previous:"" pane
Other Props:Object has no additional properties
Children:"Vertical" scroll bar
"Horizontal" scroll bar

************************************************************************************

As you can see, the Scroll Pattern is the only one available. 

I tried to use the Win32 SendMessage(gridHWND, ..) function to communicate directly with the MSFlexGrid, with no results. 

I also tried to model my Test Automation Tool as a MFC project, so that I could use the CMSFlexGrid code generated by Visual Studio when I add the MSFlexGrid ActiveX component to the project. What I tried is something like:

CMSFlexGrid grid;

grid.Attach(target_MSFLEXGRID_HWND);

long rows = grid.get_Rows();

No results again, I get an assertion error in winocc.cpp in the CWnd::InvokeHelper():

/////////////////////////////////////////////////////////////////////////////
// CWnd invoke helpers for OLE Control wrappers

void AFX_CDECL CWnd::InvokeHelper(DISPID dwDispID, WORD wFlags, VARTYPE vtRet,
	void* pvRet, const BYTE* pbParamInfo, ...)
{
	ASSERT(m_pCtrlSite != NULL);    // not an OLE control (not yet, at least)

	if (m_pCtrlSite == NULL)
		return;

	va_list argList;
	va_start(argList, pbParamInfo);
	m_pCtrlSite->InvokeHelperV(dwDispID, wFlags, vtRet, pvRet, pbParamInfo,
		argList);
	va_end(argList);
}

Does anybody know if I there is a way to read the content of a MSFlexGrid living in another process?

Many thanks in advance


Reinstall Windows 10?

So I had actually downloaded the windows 10 when it had been free during the summer, but a few weeks ago I was forced to lose everything on my laptop. This was due to my laptop's hard drive being busted, it turned out I needed a complete new hard drive installed which was the reason I lost everything on my laptop. I was wondering if, seeing as I requested the free windows 10 through my email during the summer I would somehow be able to get the installment back through my email? 

Thank You!

~Murshida Chowdhury

Making an MFC control accessible

The forum announcement says: "The typical user of this forum will be: A developer who needs to make a control accessible." Hey, that's me :-)

I am maintaining an old Windows application that makes heavy use of MFC, especially when it comes to GUI stuff. Using a different technology is not an option. My current task is to make a control accessible and ready for automated testing. This control is build like this:

  • The class is directly derived from CWnd.
  • The greater part of its visible surface is covered by child windows.
  • On what remains oncovered, the control draws some rectangles that act like buttons.

The CWnd implementation of accessibility gives me access to the child windows but (of course) not to those pseudo buttons.I started out overriding get_accChildCount and some more virtual CWnd functions, with good results as far as the inspect.exe tools is concerned. However the test automation client still fails to see the pseudo buttons, and I am at loss what else I could do. The client uses Selenium/Winium technology, which may pose an additional layer of difficulty. Maybe someone can point me to a working example of explicitly implemented accessibility in a CWnd-derived class, I hope I can work out the details myself.

(A good book might also do...)

Thank you

Hans


Issue finding child controls inside WPF Group control using UIAutomation Client and UIA Verify

We are using WPF controls and reporting framework from DevExpress XtraReports. Housed inside a custom WPF control, there is a Group control called 'BarManager' that has two child Group controls, "BarContainerControl" and "DocumentPreviewDockLayoutManager". 

When a user first opens the reporter, all expected elements are visible. The BarContainerControl, though it is visible and all of its child controls are displayed, cannot be seen by the UIA Verify tool and attempts to automate it result in null reference exceptions.

I have attempted using FindAll, FindFirst, ControlViewWalker, and RawViewWalker to grab the BarContainerControl. The only thing that makes the BarContainerControl visible to UIA is a manual click on one of the child controls prior to automation.

Is this an issue with UIA, or is it likely to be an issue with the control authors not allowing the children to be automated until a condition is met?

Any help is appreciated.

Regards, 

A. Daly

FlaUI - A new open source .NET based UIA wrapper

Hello

I would like to point you to a new wrapper for UIA. It's called FlaUI and can be found here: https://github.com/Roemer/FlaUI

It contains some ideas from TestStack.White but has a complete new code base. One of the main advantages of it is that the developer can decide to use UIA2 or UIA3 with the same API. It also provides its own inspect tool "FlaUInspect" which can be downloaded from the github page as well.

It has already full support for all patterns, input and many wrappers for controls (like ComboBox and such) so it is ready to be used in production (and already is).

I'd really like to hear some feedback and/or improvement ideas.

Thank you

Roman

Can codedUITest co-exist with older UIAutomation APIs

I'm using the UIAutomation APIs for accessibility and I'm finding  it difficult to mix CUIT and UnitTest using UIAutomation APIs.

It seems as if Microsoft stopped supporting the UIAutomation APIS such as UIAutomationClentProviders , UIAutomationClient and UIAutomationTypes.

I'm in a project in which I cannot use CUIT unless I can make it work without having to install Visual Studio in slave test machines.  Reason why I'm trying to use the older UIAutomation APIs with XUnit.

Does anyone have a clue as whether or not I can continue using the UIAutomation APIs mentioned above for automating the latest WPF developed application.

Some sound advice is appreciated if you still using those same APIs.


NR

Performing tasks like login and publish to a site

I'm not sure I'm in the right place for asking this question.

I have created a WinForm Application that connects to a web service and get a lot of statistics from that service. All this information is then exported to an Excel document. So I have developed a product from this web service for people to download. This is something I do two times a week, because this is how often the web service have new information. So creating the product (which is the Excel document) is basically done with the click of a button. That's the first step.

What I also do is the following:

2) Login to Wordpress
3) Going to the member area of this site and upload the product

Now I'm little bit tired of doing step 2 and 3. So I wonder If this is a process that can be automated?

I figure that every task a human can do online could be done by code as well. Could this be done with C# for example? Or would some other programming language be a better choice for this kind of things?

Preferable, when clicking the button to create the product (excel document) then it would be great if it could be published online as well. It would be great if all this could be done from the same WinForm Application.  

HOWTO use C#/.NET UI-Automation with Chrome.

Please help,

I am using the UI-Automation with .NET/C# for IE and Edge, and now want to make it work for Chrome. I think I am past the UAC issues, but, I can not get any UI-Automation like "IUIAutomationElement:ElementFromPoint" to work with Chrome. After some research, I'm understanding that Chrome does have some UI-automation like "extensions" like a extension called "Selenium", but I'm not able to find anything that will let Microsoft's UI-Automation work with it.

How can one get UI-Automation work with Chrome?


Need to know what accessbility role can be applied for Maps Control

Hi,

I need to find access role for maps control . What controls can be used to test in maps

Regards,

shalusri

How to get all visible words of an TextPattern using UIAutomation?

I'm using UIAutomation to get all the words from an AutomationElement that are currently visible on the screen, including its text and its bounding rectangles.

I already receive all visible lines using the TextPattern.GetVisibleRanges() method which returns an array of TextPatternRanges.

In the next step, I try to split each line into words using the TextPatternRange.Move() method with TextUnit.Word. The problem is that I could not find an indicator that tells me when I reach the last word of the line. 

I already tried comparing the endpoints of the TextPatternRanges of the line and the current word, their bounding rectangles or the length of the string containing the lines and the extracted words. But I still could not figure out when I reach the end of the line. That leads to an infinit loop in some lines because there is no indication when to end the line processing.

// Traverse all (at least partially) visible lines
var visibleLines = textPattern.GetVisibleRanges();
List<string> testresults = new List<string>();
string expectedText = "";
foreach (var lineRange in visibleLines)
{
	// Select first word
	var currentRange = lineRange.Clone();
	currentRange.Move(TextUnit.Word, 1);
	currentRange.Move(TextUnit.Word, -1);

	expectedText += lineRange.GetText(-1);
	int lineLength = lineRange.GetText(-1).Length;
	int currentLength = 0;

	// Traverse through all words of the line
	int distance = -1;
	System.Windows.Rect currentWordBounds = System.Windows.Rect.Empty;
	System.Windows.Rect lastWordBounds = System.Windows.Rect.Empty;
	while ((currentLength < lineLength) && (currentWordBounds.IsEmpty || !lastWordBounds.Equals(currentWordBounds)))
	{
		string wordText = currentRange.GetText(-1);
		currentLength += wordText.Length;
		var currentWordBoundList = currentRange.GetBoundingRectangles();
		lastWordBounds = currentWordBounds;
		currentWordBounds = currentWordBoundList.Length != 0 ? currentWordBoundList[0] : System.Windows.Rect.Empty;
		if (!currentWordBounds.IsEmpty)
			testresults.Add(wordText);

		currentRange.Move(TextUnit.Word, 1);
		distance = currentRange.CompareEndpoints(TextPatternRangeEndpoint.End, lineRange, TextPatternRangeEndpoint.End);
	}
}

Using this code, the inner while-loop does not break at the end of the line in some cases although I compare the length of the extracted words and the length of the line as well as the their bounding rectangles. I also tried to compare the endpoints of the TextPatternRanges of the current word and the line using the TextPatternRange.CompareEndpoints() method, but it always returns -1 even for the last word of the line. This is probably caused by invisible characters such as \r\n, but I don't know how to get around this issue. Unfortunately, I could not find an example that shows how to achieve this.

So my question is: How can I detect if I reached the end of a line TextPattern by using the Move method? Or which break condition should I use for the inner while loop, respectively? Or is there another, better way to split a line TextPatternRange into multiple word TextPatternRanges?


Text to Speech - Change Pronunciation?

I know that its possible to change the TTS pronunciation of a specific word within an authored program using a lexicon, but has anyone developed an  editor that modifies the pronunciation of a word for all apps and the OS itself by modifying the user TTS lexicon? The non-MS sapi5 voices such as Ivona and CereProc have their own TTS pronunciation editors that take PLS files as input, but I'm not that keen about writing my own for the MS-voices if someone has already done so.

System.windows.controls.Richtextbox control doesn't persist carriage return (Enter "\v") symbol

Hi,

In our application, we are using Richtextbox from system.windows.controls as content control to store formatted text. When we retrieve formatted text from this content control it doesn't returning us formatted text (skipping carriage return symbol).

To retrieve text from content control we are using below code,

rtb as RichTextBox

Code Snippet 1 -  

rtb.SelectAll();

rtb.Selection.Text;

Code Snippet 2 -

TextRange textRange = new TextRange(

         rtb.Document.ContentStart,

         rtb.Document.ContentEnd);

textRange.Text;

Can you please let me know how to retrieve formatted text (with carriage return) from Rich text box control.

Regards,

Nitesh Gat

ThunderRT6UserControlDC UIAutomation C++ API

Hello, 

this question is related to the one at "MSFlexGrid UIAutomation C++ API" .

I have a Desktop UI composed of VB6 ActiveX components. Some of them are standard components (like the MSFlexGrid), others are custom ActiveX components. 

I have mainly two different custom components: a ComboBox and a DatePicker. But, when I look at the Inspect tool, both show "ClassName: ThunderRT6UserControlDC" rather than specific component class names. This is a difference with the case of MSFlexGrid for which I have "ClassName: MSFlexGridWndClass". Both ComboBox and DatePicker come with an .OCX file (ComboBox.OCX and DatePicker.OCX), so that I can add "MFC Class From TypeLib" in a MFC DLL to generate C++ classes and interfaces. This is exactly what I have already done with the MSFlexGrid. 

Now, for ComboBox I can proceed successfully in the same way I have already done with the MSFlexGrid:

DWORD* pDWORD = (DWORD*)GetWindowLong(hwnd, GWL_USERDATA);
pDWORD++;
pDWORD++;
LPDISPATCH pDispatch = (LPDISPATCH)*pDWORD;

Combobox *pComboBox = NULL;
HRESULT hr = pDispatch->QueryInterface(IID__Combobox, (LPVOID*)&pComboBox);
if (FAILED(hr)) {
	// manage error
}

pComboBox->put_Text(..);

But, for the DatePicker I cannot get pDispach from hwnd because the following line returns NULL:

DWORD* pDWORD = (DWORD*)GetWindowLong(hwnd, GWL_USERDATA);

Looking at GetLastError(), I get "ERROR_SUCCESS 0 (0x0) The operation completed successfully."

What could be the reason for that? Is there any other way to get an interface to that component?

Thank you in advance.



How to force Narrator reading selection without focus on selected item in UWP

Hi,

I develop custom UWP control. Lets call it ItemsControl (IC) which is not typical - the items are not focusable.

The AutomationPeer of the IC implements ISelectionProvider and its items' peers implement ISelectionItemProvider.

Typically, in a normal control if the items were focusable, selecting the focused item will make the Narrator reads "Item 5 , Selected" or "Non Selected".

However in my case, for performance reasons the items are light kind of textblocks and do not receive keyboard focus.

The peers fire UI Automation Selection events. What else can I do to force the narrator reading the Selection change ?

Thanks for any suggestions,

Petar Mladenov

Change a recording device's 'Listen to' target via command, .bat file...

Preface: I'm not programmer, but I've made a few simple scripts. 

I want a .bat file command that could change the highlighted device below to one of two possible devices. 

My audio setup currently involves multiple virtual audio cables, and the output I receive is determined by the selected listen device. Let's just say it's a pain to manually switch this setting when i want to go from speakers to headphones.

Any way I can achieve this goal?


  1. Right click speaker in windows tray, choose 'recording devices.'

  2. Select a recording device, click properties at the bottom left.

  3. In the Properties window, select the 'Listen' tab.

  -> The device in the drop down box "Playback through this device" is what I want to change via .bat file command.

Sorry i wanted to include an image, but apparently I'm not verified.

Thanks much,

-Scott




UIAutomation adding property to cacheRequest

I can add properties to a cacherequest like so:

cacheRequest.Add(AutomationElement.IsControlElementProperty);              
cacheRequest.Add(AutomationElement.IsEnabledProperty);
cacheRequest.Add(AutomationElement.IsOffscreenProperty);

but how would I add the property that is on-screen? E.g. NOT IsOffScreenroperty

Slider with discreet values, which interfaces for UI Automation?

If I want to implement a slider that only supports discreet values (e.g., slowest, slower, medium, faster, fastest), do I need to implement both IValueProvider and ISelectionProvider? The docs list both when mentioning a slider with discreet values, but it doesn't explicitly state you need both, or if it is either/or.

Customize what a screenreader says for a slider's value

I have a volume slider, so I implemented IValueRangeProvider with min/max values of 0/100. However, I would actually like a screen reader to say "0%" or "100%" instead of just "100.0", like it does now. How can I do this?

Using CodedUI, Record and Play back option is disabled for UWP desktop application

HI All,

I need to test UWP Desktop application using Coded UI in Windows 10 & VS2017. But Record option is disabled. But when i try for Web application, Record option is enabled. Please let me know how to solve this issue and provide me steps to record UWP Desktop. 

UIAutomation WPF COM Access Violation Exception

Hi, 

I am using UIAutomation to test a WPF app where I have created a few of my own peers. Occasionally I get an exception in the COM layer which completely crashes my application under test. I have managed to get a crash dump but it doesn't seem to relate to any of my code. Does anyone know what might be causing this? Or anyway to get more information?  

Event Viewer

2018-05-11 10:18:13,000 Level=2 Faulting application name: XXXXX.exe, version: XXXX, time stamp: 0x5af43754
Faulting module name: UIAutomationCore.dll, version: 7.0.0.0, time stamp: 0x4a5bdb1d
Exception code: 0xc0000005
Fault offset: 0x00008f23
Faulting process id: 0x2254
Faulting application start time: 0x01d3e9086fc10688
Faulting application path: C:\XXXX.exe
Faulting module path: C:\Windows\system32\UIAutomationCore.dll
Report Id: 3a3a7f26-54fc-11e8-951f-6c626de989be

Dump Stack

Call stack below ---
 # ChildEBP RetAddr  Args to Child              
00 242ceb50 19390992 00000000 11dd1b38 11e275d0 UIAutomationCore!QI<IRawElementProviderSimple>+0x9 (FPO: [Non-Fpo])
01 242ceb78 193bc4c9 18f12a94 00000000 00000001 UIAutomationCore!UiaNode::CrossProcess_SetFocus+0x11c (FPO: [Non-Fpo])
02 242ceba0 193bd562 11e275d0 193ed740 11dd1b38 UIAutomationCore!RemoteUiaNodeStub::Incoming_SetFocus+0x46 (FPO: [Non-Fpo])
03 242cebbc 193b7b4b 11e275d0 193ed740 11dd1b38 UIAutomationCore!RemoteUiaNodeStub::OnMessage+0x93 (FPO: [Non-Fpo])
04 242cebdc 193b27e2 242cebf8 242cec14 193b7b94 UIAutomationCore!InvokeOnCorrectContext2_Callback+0x1c (FPO: [Non-Fpo])
05 242cebe8 193b7b94 193b7b2f 242cebf8 193bd4cf UIAutomationCore!NullInvoker::CallTarget+0xb (FPO: [Non-Fpo])
06 242cec14 193b8aac 193bd4cf 11e275d0 193ed740 UIAutomationCore!InvokeOnCorrectContext+0x40 (FPO: [Non-Fpo])
07 242cec58 193b8f7a 242cec70 242cec84 11dd1b38 UIAutomationCore!ProcessIncomingRequest+0x142 (FPO: [Non-Fpo])
08 242cfc9c 193b6c64 242d0060 00000006 11dc8578 UIAutomationCore!ChannelBasedServerConnection::OnData+0x52 (FPO: [Non-Fpo])
09 242cfccc 193b67b8 242cfce4 00000000 00000000 UIAutomationCore!ReadWriteChannelInfo::Service+0x178 (FPO: [Non-Fpo])
0a 242cfcec 193b69d2 242cfd00 75d2343d 193ed7c8 UIAutomationCore!OverlappedIOManager::IoThreadProc+0x27 (FPO: [Non-Fpo])
0b 242cfcf4 75d2343d 193ed7c8 242cfd40 773c9832 UIAutomationCore!OverlappedIOManager::StaticIoThreadProc+0xd (FPO: [Non-Fpo])
0c 242cfd00 773c9832 193ed7c8 14efdeeb 00000000 KERNEL32!BaseThreadInitThunk+0xe (FPO: [Non-Fpo])
0d 242cfd40 773c9805 193b69c5 193ed7c8 00000000 ntdll!__RtlUserThreadStart+0x70 (FPO: [Non-Fpo])
0e 242cfd58 00000000 193b69c5 193ed7c8 00000000 ntdll!_RtlUserThreadStart+0x1b (FPO: [Non-Fpo])

Thanks 

Ronnie



Viewing all 585 articles
Browse latest View live


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