Results 1 to 6 of 6

Thread: Sendmessage to a textbox on another program

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Question

    Hi,
    I'm creating a program that will have plugin support but there is still hurdle to cross. I want each plugin to be able to send message or command to the Parent application as well as recieve commands from the Parent. I was hopin that I could create a control on the Main form of the Parent Application and then subclass it so that I can track all messages that are been sent to it.

    Now, my question is how do I send a message(command) from another application to a textbox on the Parent application?

    If have any ideas or suggestions please let me know. I've got everything else to work except this.
    Omar
    omarswan@freemail.org.mk
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  2. #2
    Fanatic Member Dim's Avatar
    Join Date
    Jul 2000
    Posts
    620
    I'm a little confused but what i think you want is in the lines of:
    Code:
    AppActivate "Calculator"
    SendKeys "5"
    Simply change the Calculator part to the caption of the program that you are sending keys too.

    Gl,
    D!m
    Dim

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 1999
    Location
    NY, USA.
    Posts
    240

    Question No - I Think you misunderstood me

    No,
    It has something to do with the SendMessage API.

    The concept I'm trying to implement is used by those Winamp Controler modules created in VB, that are used to send and recieve mesage from WinAmp.
    Omar
    omarswan@freemail.org.mk
    http://omar.caribwalk.com
    To God Be The Glory

    I see Tech People ...

  4. #4
    Guest
    This will send text to the TextBox in Notepad.

    Add the following to a Form with a Commandbutton.
    Code:
    Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
    Private Const WM_KEYDOWN = &H100
    Private Const WM_CHAR = &H102
    
    Private Sub Command1_Click()
        Dim hEdit As Long
        hEdit = FindWindowEx(FindWindowEx(0, 0, "Notepad", vbNullString), 0, "Edit", vbNullString)
        If hEdit <> 0 Then
            SendMessage hEdit, WM_CHAR, vbKeyA, 0
        End If
    End Sub

  5. #5
    Frenzied Member
    Join Date
    Jun 2000
    Location
    England, Buckingham
    Posts
    1,341
    How do i send to a specific tbox ?
    How do i send the data to a app without a cpation ?, can i use hwnd ?

  6. #6
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    617

    ....

    THIS WAS SUBMITTED HERE A WHILE BACK

    Hi,

    Here is an *OLD* sample that i have.

    Creating Microsoft® Visual Basic Application w/ DDE Links

    How do you communicate with another VB application using DDE links ? The following example demonstrates the simple process:


    SOURCE PROGRAM

    1. Create a new application called "SAMPLESR"
    2. Set the form link mode to "Source".
    3. Set the form Name to something like "FormSource".
    4. Set the form link topic to same as above "FormSource".
    5. Place your link objects on the form, such as the text box.
    6. Compile the program with the same application name.

    DESTINATION PROGRAM

    1. Create a new application called "DESTPROG".
    2. Place a text box on the form.
    3. Set the text box link topic to the source program and its linktopic name, example "SAMPLE|ORMSOURCE". <- Same as above !
    4. Set the text box link Item to "Text1" because thats the text box you want to read from on the source application.
    5. Place a command button or something to execute a "ext1.LinkMode = 1". This causes the destination application to contact the source application a begin the DDE link.

    ' DESTPROG

    Private Sub Command1_Click()
    Text1.LinkMode = 1
    End Sub

    ' SAMPLESR

    Private Sub Text1_LinkOpen(Cancel As Integer)
    Text1.LinkMode = 1
    End Sub


    Private Sub Timer1_Timer()
    Randomize 0
    Text1 = Int(Rnd(1) * 99999) ' or what ever
    End Sub


    Regards
    __________________

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width