On 4/11/2012 6:21 PM, RicksPlace wrote:
I never got MSAA working properly and had some other problems which I
couldn't resolve.
Do you remember what the issues were? I whipped up this example real
quick which demonstrates speaking "I has a button" any time a button
accessible gets focused:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using WindowEyes;
namespace MSAAEventProc {
public partial class MSAAEventProc : Form {
private WindowEyes.Application weApplication = null;
private WindowEyes.ClientInformation weClientInformation = null;
private WindowEyes.Speech mySpeech = null;
private WindowEyes.MSAAEventSource myMSAAEventSource = null;
public MSAAEventProc() {
Debug.WriteLine("init");
InitializeComponent();
// Get the application object
weApplication = new WindowEyes.Application();
// Introduce ourselves to Window-Eyes
weApplication.ClientIdentify(System.Diagnostics.Process.GetCurrentProcess().Id);
weClientInformation = weApplication.ClientInformation;
// Hook Shutdown so we can clean up
weClientInformation.OnShutdown += new
ClientInformationEvents_OnShutdownEventHandler(weClientInformation_OnShutdown);
// Hook MSAA events
myMSAAEventSource = weApplication.MSAAEventSource;
myMSAAEventSource.OnObjectFocus += new
MSAAEvents_OnObjectFocusEventHandler(myMSAAEventSource_OnObjectFocus);
// Set up Speech so we can talk
mySpeech = weApplication.Speech;
}
private void
myMSAAEventSource_OnObjectFocus(WindowEyes.Accessible accObj) {
bool handeledEvent = false;
try {
// Prefetch all the Accessible info
accObj.Prefetch(AccessibleProperty.apAll);
// If it's a button, we'll handle it.
if (accObj.role.Value ==
AccessibleRoleEnum.role_SYSTEM_PUSHBUTTON) {
mySpeech.Speak(accObj.Name + ". I has a button!");
}
} catch (Exception e) {
// Something bad happened;
}
if (!handeledEvent) {
// Simulate the event
accObj.SimulateEvent(MSAAEventID.event_OBJECT_FOCUS,
AccessibleProperty.apAll);
}
}
private void weClientInformation_OnShutdown() {
// Bye
Close();
}
}
}
Aaron
--
Aaron Smith
Web Development * App Development * Product Support Specialist
GW Micro, Inc. * 725 Airport North Office Park, Fort Wayne, IN 46825
260-489-3671 * gwmicro.com
To insure that you receive proper support, please include all past
correspondence (where applicable), and any relevant information
pertinent to your situation when submitting a problem report to the GW
Micro Technical Support Team.