Question Using SendKeys.Send / SendWait doesn't work

abandel

New member
Joined
Mar 22, 2008
Messages
2
Programming Experience
1-3
Hi Guys,
I have a vb.net application, which is an SAP Business One (SBO) add-on -- it uses the SBO COM components to communicate with SBO client.
Everything works fine.
Now, I'm trying to send the 'enter' key to the SBO application, while my add-on is running, when SBO has some dialog window, waiting for the user to press 'Ok'.
I couldn't do it with SendKeys.Send (got the exception which says I need to try SendWait) and with SendKeys.SendWait.

As a test, I've tried sending keys to an open Word application, by:
VB.NET:
Dim hWnd As Integer = FindWindow(Nothing, "microsoft word") ' can also use AppActivate(3404), works the same
Windows.Forms.SendKeys.SendWait("^n")
I saw the Word window coming to the foreground, but nothing happens upon executing the SendWait Sub.

I've used both 'Console Application' and 'Windows Forms Application' for the 'Application Type' property.
The Sub Main() of my app goes like that:

VB.NET:
Sub Main()

    Dim splashScreen As New ONC.SplashScreen.splashScreen
    Try

      '' 1: intialize the addon
      Try

         ' show spalsh screen
        splashScreen.show(My.Resources.sConnectingToSBO)

         ' connect to SBO
        SBO_Addon_Connect_To_SBO()

 
      Finally

        splashScreen.hide() ' hide splash screen

      End Try

      '' 2:  Start the message loop to handle sbo_app events
      System.Windows.Forms.Application.Run()

    Catch ex As Exception
      MsgBox(String.Format(My.Resources.exAddonCannotLoad, ex.Message))
    End Try
  End Sub

I've googled and didn't find anyone with this issue... anyone have an idea about why this is not working?
 
Back
Top