How To: Creating Software Integrations Part3

Here you will find tutorials that will help you with programming.

How To: Creating Software Integrations Part3

Postby autopilot » Mon Jan 14, 2008 1:17 am


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:
Code: Select all
        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:
Code: Select all
    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!!!
User avatar
autopilot
Forum Moderator
Forum Moderator
 
Posts: 356
Joined: Sat Sep 23, 2006 7:19 pm

Return to Programming Tutorials

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 0 guests