Results 1 to 11 of 11

Thread: interface with another app

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Pittsburgh, PA
    Posts
    329
    my program needs to be able to read and display information that is in another app's textboxs. how do i do this?

    for example:

    i need to get the text out of aol instant messenger's screen (the screen that shows the converstation)
    i then need to put the text in my own textbox



    thanks in advance for any help!!!
    ______________

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539

    Talking use of apis

    you have to read the handle of the aol form/screen using api
    and you go from there

    *i never have done it so i wodn't know EXACTLY how it would be* but you will be using some apis to do this

  3. #3
    Guest
    I believe this is what you want:

    Code:
    Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
    Public 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
    Public Declare Function SendMessageLong& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long)
    Public Declare Function SendMessageByString Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
    Public Const WM_GETTEXT = &HD
    Public Const WM_GETTEXTLENGTH = &HE
    
    Private Sub Command1_Click()
    Dim aimimessage As Long, wndateclass As Long, ateclass As Long
    aimimessage = FindWindow("aim_imessage", vbNullString)
    wndateclass = FindWindowEx(aimimessage, 0&, "wndate32class", vbNullString)
    ateclass = FindWindowEx(wndateclass, 0&, "ate32class", vbNullString)
    Dim TheText As String, TL As Long
    TL = SendMessageLong(ateclass, WM_GETTEXTLENGTH, 0&, 0&)
    TheText = String(TL + 1, " ")
    Call SendMessageByString(ateclass, WM_GETTEXT, TL + 1, TheText)
    TheText = Left(TheText, TL)
    Text1.Text = TheText
    End Sub

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Pittsburgh, PA
    Posts
    329
    that looks good, but what if the application isnt aim?

    my problem is my program is made to interface with multiple programs. it there a way to send a message box to the user every time he sets the focus on a new window and ask him if this is the window that he wants my program to interface with?

    sorry if this is kindof confusing. if it is tell me and i'll try to clear it up.

    thanks to everyone who replied so far.
    ______________

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Pittsburgh, PA
    Posts
    329
    to Matthew Gates (or anyone who knows):

    in this line of the code you gave me:

    Code:
    aimimessage = FindWindow("aim_imessage", vbNullString)
    how did you come up with: "aim_imessage" (in quotes)

    how do you know automatically what name it goes by?


    [Edited by HAVocINCARNATE29 on 09-07-2000 at 09:14 PM]
    ______________

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    You use a spy program such as Spy++. I can email you VB source to one if you want.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7
    Guest
    aim_imessage is the class.

    I used PatorJK's Api Spy 5.0 to get the class. There's also an option to get a windows text on there.

  8. #8
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Or you could switch it:
    Code:
    aimimessage = FindWindow(vbNullString, "Notepad")
    'to find it with the windowtitle.
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Pittsburgh, PA
    Posts
    329
    first,parksie please send me that source.

    second:

    now i know whet i need to do. 1 question first.

    is there an api call to get the class of the window that has the focus?
    ______________

  10. #10
    Hyperactive Member Azz00's Avatar
    Join Date
    Sep 2001
    Location
    Scotland
    Posts
    457
    how could i do what that does but with mirc ?
    www.azzmedia.co.uk

  11. #11
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943

    i know this is an old question... but....

    okay, i got the code to work, but it only tracks one window... how can i make it loop through all the open AIM windows??
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

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