Hi Guys:
I found an Excel example of using what appears to be delegates and set up my 
code to match the delegate portion of the code using the WindowEyes handlers 
exposed in the error message noted in the prior post.
The underlying target application, vb.net 2010 express, still seems to lock up 
as it did using the native AddHandler statements.
Any ideas from this code snipet?
Am I doing everything all wrong, is there a bug in WindowEyes? I dont know what 
to try or where to turn next.

Here is the relative code in my program 
Note: weApplication is assigned to WindowEyes.Application
Public Module LaunchApp
Public EventDel_OnKeyDownEventHandler As 
WindowEyes.KeyEvents_OnKeyDownEventHandler
Public EventDel_OnKeyUpEventHandler As WindowEyes.KeyEvents_OnKeyUpEventHandler
Public Sub Main()
Application.Run(New InitProc)
End Sub
End Module    
Public Class InitProc
Inherits ApplicationContext
Public Sub New()
EventDel_OnKeyDownEventHandler = _
New WindowEyes.KeyEvents_OnKeyDownEventHandler( AddressOf OnKeyDownHandler) 
EventDel_OnKeyUpEventHandler = _
New WindowEyes.KeyEvents_OnKeyUpEventHandler( AddressOf OnKeyUpHandler) 
AddHandler weApplication.Keyboard.OnKeyDown, EventDel_OnKeyDownEventHandler 
AddHandler weApplication.Keyboard.OnKeyUp, EventDel_OnKeyUpEventHandler 
weApplication.Keyboard.WaitForAllKeysUp()
End Sub
Public Function OnKeyDownHandler( _
ByVal ReturnedKey As Integer, ByVal ReturnedModifiers As 
WindowEyes.KeyModifiers) _
As WindowEyes.KeyDisposition
Dim AppropriateDisposition As WindowEyes.KeyDisposition
AppropriateDisposition = WindowEyes.KeyDisposition.kdProcess
Return AppropriateDisposition
End Function
Public Function OnKeyUpHandler( _
ByVal ReturnedKey As Integer, ByVal ReturnedModifiers As 
WindowEyes.KeyModifiers) _
As WindowEyes.KeyDisposition
Dim AppropriateDisposition As WindowEyes.KeyDisposition
AppropriateDisposition = WindowEyes.KeyDisposition.kdProcess
Return AppropriateDisposition
End Function
End Class
Public Class ScriptLog
Public Shared Sub WriteLine( ByVal Line As String )
Dim ThisFilePath As String = _
Globals.ProjectDirectoryPath & _
"\ScriptLog.txt"
Try
File.AppendAllText( ThisFilePath, Line )
File.AppendAllText( ThisFilePath, vbCrLf )
Catch ex As Exception
MessageBox.Show( "Exception in ScriptLog, " & ex.ToString() )
End Try 
End Sub
Public Shared Sub Clear()
Dim ThisFilePath As String = _
Globals.ProjectDirectoryPath & _
"\ScriptLog.txt"
File.Delete(ThisFilePath)
WriteLine( DateTime.Now )
End Sub

End Class

Reply via email to