Option Explicit On Class ThisRule Declare Function PostMessage& Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Object) Declare Auto Function SetFocus Lib "user32" (ByVal hWnd As IntPtr) As IntPtr Private Const WM_KEYDOWN As Long = &H100 Private Const WM_KEYUP = &H101 Private Const WM_CHAR = &H102 Sub Main() ' Dim trig = iTrigger0 ' Trace.WriteLine(" -- Running Rule: Rule0 ----------" ) Dim hWnd As IntPtr = ThisApplication.MainFrameHWND SetFocus(hWnd) PostMessage(hWnd, WM_CHAR, Asc("E"c), 0) End Sub End Class