Hi: I have a VB.net script working until I try and use the MSAAEventSource. 
I had some hot keys code which I removed for clarity which are working. 
I handled the MSAAEventSource the same way that the ClientInformation object 
was handled unless I missed something. 
Everything other than the MSAAEventSource code seems to work fine. 
Below is the code for trying to handle the MSAAEventSource and 
ClientInformation objects. 
I pulled the ClientInformation code pretty much directly from the GW VB.net 
sample script.
I am getting no errors or warnings but the 
Private Shared Sub OnObjectFocus( Acc As WindowEyes.Accessible ) _
Handles MSAAEventSource.OnObjectFocus
Subroutine does not seem to be getting executed when I navigate around the 
associated application (CSharp Express 2008). 
Can you spot anything I might be doing wrong in handling the MSAAEventSource to 
try and capture the OnObjectFocus event?

BeginCopiedCode:
Imports System.Diagnostics
Imports System.Runtime.InteropServices
Imports Windoweyes
' Note, outer class to hold required "Global" variables and start message pump.
Public Class AppContext
Inherits ApplicationContext
Private Shared app As WindowEyes.Application
Private Shared WithEvents clientInformation As WindowEyes.ClientInformation
Private Shared WithEvents MSAAEventSource As WindowEyes.MSAAEventSource
Private Shared Speech As WindowEyes.Speech
Public Sub New()
MyBase.New()
SetUp.SetUp()
End Sub
Private Shared Sub OnObjectFocus( Acc As WindowEyes.Accessible ) _
Handles MSAAEventSource.OnObjectFocus
Speech.Speak( "Focus Set")
Logger.WriteLine( "Should Have Spoken in OnObjectFocus sub" )
Speech.Speak( "Focus Set")
End Sub
Private Shared Sub clientInformation_OnShutdown() Handles 
clientInformation.OnShutdown
System.Windows.Forms.Application.Exit()
End Sub
' The below is a nested class using outer class variables.
Public Class SetUp
Public Shared Sub SetUp()
app = New WindowEyes.Application()
Speech = app.Speech
app.ClientIdentify(System.Diagnostics.Process.GetCurrentProcess().Id)
            clientInformation = app.ClientInformation
clientInformation.ScriptName = "RicksWEComScript"
clientInformation.ScriptDescription = "This is my test script." 
clientInformation.ScriptHelp = "This is a help string in ClientInfo."
MSAAEventSource= app.MSAAEventSource 
Dim event_OBJECT_FOCUS As Long = &H8005
MSAAEventSource.WatchEvent( event_OBJECT_FOCUS )
End Sub
End Class
End Class
EndCopiedCode:
Note that some of the lines wrapped in this e-mail but are clean in the code 
editor.

I hope you can help as things look correct - at least as far as I understand 
them so far but they just dont work to capture the OnObjectFocus event. 
Thanks:
Rick USA

Reply via email to