Microsoft Active Accessibility, VB6 and Ranorex - c++

Ranorex is a user interface test tool for Windows. If UI elements support Microsoft Active Accessiblity (MSAA) then it can retrieve rich information about the elements, which is very useful for writing test scripts.
We have a lot of legacy code in VB6, which does not support MSAA.
I am trying to add this support to some of our VB6 UserControls as follows.
I have created an ActiveX component in C++ using ATL. This contains a helper class which implements the interface IAccessible. It also contains an initialization function which can be called from VB6.
The VB6 UserControl creates the helper object and passes its Window Handle and name to the initialization function. The helper object subclasses the window and handles the WM_GETOBJECT message, to provide the IAccessible interface for the window.
I have debugged through the code and as far as I can tell, it is working. The Ranorex Spy tool gets the IAccessible interface and calls methods on the interface.
However, Ranorex does not actually show any of the information which it appears to have fetched via this interface.
I know this is a very specific problem, but does anybody have experience of implementing IAccessible for use in Ranorex, or in other similar test tools?
I would be happy to provide my code, but I think it is too much for a normal posting.

This doesn't ever seem to have been widely used. I have found a few breadcrumbs I can share, so perhaps these will be of some value?
First:
Microsoft Active Accessibility 2.0 ships as a standard system component in Microsoft Windows XP...
This is from the MSAA20RDK\redist.txt and it goes on to talk about how it can be installed into Win2K and earlier. As far as I can determine the pieces and parts are included in XP and later so you probably don't need the RDK download, which has basically no info at all and mostly just the DLLs.
Here's a link though:
Microsoft Active Accessibility 2.0 Redist
Something perhaps more useful, note that this is a "live" link to download the Word DOC:
Microsoft Active Accessibility 2.0
I haven't found a "page" link at MS Downloads that discusses it. This is a larger document giving many details, almost entirely for C++ programmers. There is however a little bit on VB6.
That said it tells you little except:
Visual Basic Sample Programs
The book Advanced Microsoft Visual Basic 6.0, 2nd Edition (Mandelbrot Set
International, Ltd.) includes a chapter that discusses Active
Accessibility. The chapter provides sample code that demonstrates how to
use key Active Accessibility APIs. (Microsoft Press, ISBN 1-57231-893-7)
There is a little more there but not much. The book cited could be pretty hard to find anymore, I only saw one in Italian on Amazon but dig around and a 3rd party might sell there or on eBay, etc.
At this link: Microsoft Active Accessibility the info from that Word DOC appears to be duplicated, though perhaps it is more current.

Related

Windows Phone with C++

I want to make a Windows Phone app (version 7.5 and 8 preferably) in C++. I searched the net and came to know that for this purpose XAML is not supported and I will have to generate the UI from C++ itself, which I don't know how to. But in Windows Store apps, UI is generated by XAML and code-behind by C++/CX, which I find better. Is it possible to use C++/CX and XAML for the purpose or if you can give some resource on generating UI with C++?
Check out these links:
http://social.msdn.microsoft.com/Forums/en-US/wpdevelop/thread/98475feb-076f-434d-a5c8-24c8ccc4c9c0/
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681687%28v=vs.105%29.aspx
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj681693%28v=vs.105%29.aspx
I would encourage you to:
Write your main project in C# (using XAML)
Invoke (native, unmanaged) C++ modules as needed (for performance)
And please remember that XAML itself isn't necessarily portable between platforms.
As far as I know there are libraries for C# and VB.net for Windows Phone. XAML is very easy to use so you will not lose anything to write some. Also you have to think if your app will pass certification. So better speak with the support team of windows phone to get some help.

Gauge Control for C++ Application

Can anyone suggest good Gauge controls to use in application using C++.
The Gauges will be used in application monitoring Temperature, Pressure or Flow devices.
Please let me know about any commercial or free libraries that works on pure C++, without any dependency on .Net framework
Thanks,
For wxWidgets there are the (free) wxIndustrial controls. Update 11/2015: last updated in 2007, no downloads but source code still available here
Also you'll find more controls at wxCode.
I suggest you to give a look to National Instrument's Measurement Studio.
I am adding the link: NI-Measurement Studio
The title might be a bit confusing since it says: NI Measurement Studio
for Unmanaged Visual C++ .NET but Measurement Studio 2009 (and previous) also has C++ libraries that do not depend upon the .NET framework. They are MFC controls.
In that same page, you can actually clic the link to try it and decide for yourself.
QWT is an extension to the Qt GUI library. You can use this library to create Dials, Compasses, Knobs, Wheels, Sliders, Thermos etc.
Also check QGauge
You may try BeauGauge Instrumentation Suite.
Preview of Gauges
http://www.beaugauge.com/en/gallery.html
Demo Download
http://www.beaugauge.com/en/downloads.html
Here you go. It is completely free but for commercial use you should probably pay license fee.
http://www.mitov.com/html/instrumentlab.html
You may try ChartFX Gauges COM: http://www.softwarefx.com/sfxComProducts/cfxForCom/

QTP / Dynamic Great Plains automation

I have recently completed a detailed investigation regarding GP functional test automation possibilities with QTP, TestComplete, and other GUI recognition/interaction tools.
In short, none of the tools acted well. Mentioned above did best but still featured a lot of hard-coding in recorded sample scripts. QTP did significantly better though.
Some of the GUI were recognized under .NET (swf... in QTP) and handled well. Some other were recognized as swfObject only but accessing native methods and properties allowed performing required interaction.
Finally, object internally named "Microsoft.Dexterity.Shell.DexDialogHost" renders objects that seem don't have Windows Handle and thus unrecognizable by QTP. I haven't found any detailed documentation on those objects family (like class reference to find out names of methods).
So I was wondering if someone could share experience automating GP and what tools / approach were used.
Thanks.
If QTP doesn't recognise some controls you can extend the set of controls it supports by using .NET Extensibility. This allows you to add new functionality which is relevant for these controls but is not supported out of the box by QTP. Note that some .NET programming is required.
The documentation for .NET Extensibility is available at Start > Programs > QuickTest Professional > Extensibility > Documentation > .NET Add-in Windows Forms Extensibility Help
Fact of the day: The SWF in .NET objects' names in QTP stands for System Windows Forms.
With regards to the objects that were partially successful, the ones you noted were recognized as SwfObject - if these logically map to a standard class, you can configure QTP to treat it as a standard class. For example, if you have an SwfObject that behaves like a button, you can configure QTP to record and replay as if it is a standard button.
[removed suggested keystroke+clipbaord work-around as it is inappropriate for this situation given further information that there are multiple Dexterity dialogs, each with many objects]
It took a while for me to conduct a research, and then practically prove the concept.
I started series of posts about Great Plains automation success story where I put all the details and steps of my investigation along with sample code.
http://automation-beyond.com/2009/08/24/great-plains-automation/
http://automation-beyond.com/2009/08/26/dynamics-great-plains-gui/
http://automation-beyond.com/2009/09/01/gp-automation-utilizing-com/
(to be continued)
Here's the summary.
Microsoft Dynamics Great Plains has its own completely independent GUI/Event system (Dexterity) that makes it cross-platform product. The same thing makes it almost completely "black box" not accessible from outside.
Platform-specific engine supports COM Automation and various integration models for Windows platform. All these are gathered under Continuum Integration Library name.
What is especially useful for Test Automation needs, Continuum provides high-level methods to simulate user inputs for the GUI thus acting the same way as Test Automation Tool does.
Wherever Continuum doesn't cover Test Automation needs, direct calls of sanScript (Dexterity's internal scripting language) could be executed in real-time.
With all the above, I created custom "Dexterity GUI" component for Quick Test Professional enabling functional test automation of Microsoft Dynamics Great Plains application. Of course, without any use of keyboard/mouse hard-coded workarounds.
Thank you.
You can download the .NET Add-In from hp.
link text

How do I create a non managed Windows GUI in Visual C++?

When I create a 'Windows Forms Application', the resultant program is a managed one. Creating a 'Win32 Application' results in a native one, but when I try to add a form I'm informed that the project will be converted to CLI if I continue. How do I design a native Windows GUI with Visual C++ 2008 Express Edition? I'm probably being very silly here, but I just can't figure it out.
Either use MFC, WTL, or straight Win32 API. You can't use forms (or any of .NET) without switching into managed code.
MFC is Microsoft Foundation Classes - the most common C++ windows library
WTL is Windows Template library - a better C++ windows library IMO
Win32 is CreateWindow, DialogBox, etc, everything else is a wrapper around the Win32 api.
You just need to avoid the managed libraries. Most likely, this will mean using MFC for the GUI, instead of Windows Forms. For details, see MSDN's MFC pages.
Unfortunately, VC++ Express Edition doesn't support MFC directly, so you'll have be more limited. It is possible to compile MFC projects using the Express Edition, but you lose all of the Wizards, etc. If you are serious about doing non-managed GUI development, you should consider upgrading to a higher level SKU.
Another option would be to use Qt for for GUI. It is now LGPL, so usable, for free, in even commercial C++ projects, and includes a full designer.
This is an answer to the linked question. Unfortunately, that has been closed by Robert Harvey because he thinks it is a duplicate. It is not, sorry Bob.
The best library for creating xll's is http://xll.codeplex.com. You can use that to create rudimentary user interfaces using Excel macros. One example of that can be found in the ALERT.FILTER macro in xll/error.cpp
As Reed Copsey, MFC would be the "default" way of creating a native unmanaged GUI on the Windows platform. However, MFC is not included with Visual Studio Express. Consequently, you would either need to upgrade to the full version or you could look into using a freely available C++ GUI library such as wxWidgets.
There is also wxFormsBuilder if you want a GUI editor.
You could also go down to the "bare metal" and code right to the Win32 API, maybe take some help from the common controls library. But you'll be entering a world of pain ;)
You would need to use a native application framework. For Windows this means MFC or the bare Win32 libraries. WinForms use .NET libraries in the background and therefore need to be managed.
Native applications don't use "forms". For a native application, you could create, for example, an MFC application. If you want it to be something like a form-based application, you can tell the wizard you want a dialog-based application, or (on the last page of the Wizard) have your view derive from CFormView instead of CView.
Alternatively, you might want to use WTL -- though that means writing essentially all your code by hand instead of using wizards and such.
Windows Forms is the name given to the graphical application programming interface (API) included as a part of Microsoft's .NET Framework, providing access to the native Microsoft Windows interface elements by wrapping the existing Windows API in managed code.
Wikipedia
Most of the above answers explain things pretty well - if you want to look into creating a pure Win32 Native App form (no MFC/WTL etc) take a look at the tutorials here: http://www.zetcode.com/tutorials/winapi/ for starters. That's the third time I've linked to this site on here, but his tutorials are very good.
Note - at this stage there's nothing "visual" about it except the result - it is all done in code, although that said I don't think it is too difficult really. It will definitely be good programming experience.
Windows Forms are a GUI framework written in managed code, so you cannot use Forms in a native application.
With a native application, you have to create windows. Programming Windows by Charles Petzold is the definitive how-to book for this. It's a lot of work compared to using a good framework. MFC (Microsoft Foundation Classes) is a framework for native Windows GUIs. I don't know if it comes with VC++ Express.
I noticed that no one mentioned JUCE which can be used to build cross platform user interfaces in C++. I thought it was pretty cool. Looks like it's been expanded to support mobile devices too since I used it.
Personal and Educational licenses are free. 'Pro' and 'Indie' licenses are relatively cheap.

searching for winapi functions

I'm learning programing windows applications with C++. Now I'm reading about messages and I'm playing with the spy++.
What function spy++ use in order to mark/highlight the window under mouse cursor?
Also, can you give me some tips about using MSDN? I'm my opinion is not user friendly at all.
I'm learning programming by myself and i can't get some real life experience tips as those which are learning at college or in teams.
ty
Not sure exactly what your problem with MSDN is ... I tend to go to e.g. Win32 and COM development and look around for a suitable category in the listing to the left, then click down from there. Or just enter function names and search if I already know what I'm looking for but want the reference documentation. On the other hand, I'm not much of a Win32 developer.
I think spy++ is just inverting the colors directly on the window/screen DC (You could use InvertRect() for example) On Windows 2000 and later, it is probably better to use a translucent layered window if you actually wanted to implement this window highlight since some graphic corruption can occur when messing with other windows behind their back.
Writing a Windows application with just the windows API is possible, but you'll end up writing huge amounts of boilerplate code just to create simple things. This is why people normally use libraries built on top of it to make things easier - MFC for example.
The MSDN article Creating Win32 Applications provides a good explanation of the ins-and-outs of a Windows application using the Win32 API. Bare in mind though that you could build the same application in minutes using MFC.
I agree that MSDN is not the most user friendly source of information for a beginner. In my opinion it works much better as a reference.
My advice would be to focus on building some test applications using MFC (assuming you are tied to C++ as a language). Try looking at the codeproject MFC sections for example, and perhaps even buy a book to help get you started. This does of course require Visual Studio, but you can download the free express edition here