Skip to content

How To: Creating Software Integrations Part3

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #190361
    autopilot
    Member

    So far we have opened the Notepad program and found the handle for the Edit control. The next step is to send text to the Edit control. To send text to the Edit control, we will use the SendMessage API that was descussed and added to the project earlier. The first object required by SendMessage is the control handle. The second object required is the Windows message and for us, we need the SetText message (defined as Const WM_SETTEXT As Integer = &HC). The third object for sending text is 0. And finally, the last object is the text to be sent. The call will be made like this:

    SendMessageAsString(EditHndl, WM_SETTEXT, 0, "Hello World")

    So let’s edit the button3 code. Rem out the msgbox line by placing at the beginging a ‘. Then add the above sendmessage line so the whole code looks like:

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
    Dim EditHndl As Integer = GetSubFormByClassNameWithMWClassWithMWCaption("Notepad", "Untitled - Notepad", "Edit", 1)
    'MsgBox(EditHndl.ToString)
    SendMessageAsString(EditHndl, WM_SETTEXT, 0, "Hello World")
    End Sub

    Success!!!

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.