Results 1 to 11 of 11

Thread: External applications

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    30
    Ok, i have been looking all over the net for this crap and i cant seem to find it anywhere.

    All I want is something that allows me to access a text box or a command button in another program. LIke using windows handles and stuff. I have used spy++ and found the handles, I just cant figure out how tomanipulate them using my code and my applications.

    If someone could help me I would be very thankful...
    --> noware <--
    john@wet-online.com

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    Jop has just made an excellent class for doing things like this. It can do these things:
    Code:
    AlwaysOnTop      > Sets the specified window (by hWnd) always on top or not.
    Caption          > Sets or gets the caption of a specified window or control (by hWnd).
    Click            > Click the specified window (by hWnd) at a specified point.
    CloseWindow      > Closes the specified window (by hWnd).
    Enabled          > Enable or Disable the specified window (by hWnd) or get it's status.
    FindWin          > This gets the hWnd of a window by it's caption or classname.
    FindWinEx        > This gets the hWnd of any child window or control by it's caption or classname.
    FlashWin         > This flashes the specified window by a specified time.
    GetAllWindows    > This gets all open windows in an array (pass it a variant).
    GetMetrics       > This gets the Rectangle of the window (top, left, right, bottom) in a RECT.
    GetMousePos      > This gets the coordinates of the mousecursor in a POINTAPI.
    GetWinProperties > This gets the properties (left, top, width, height, classname, caption) from a window (by hWnd).
    GetWndClassName  > This gets the classname from a window or control.
    MouseDown        > This pushes down (and hold) the specified mousebutton on the point where the mouse is.
    MouseUp          > This triggers the MouseUp event to release the MouseDown (MouseDown + MouseUp = Click)
    Move             > This is used to move and/or resize a window or control.
    Redraw           > This is used to Redraw (refresh) a specified window (it triggers the PAINT method for that form)
    SetFocus         > This sets the focus (it's sets it to the foreground) to a specified window (by hWnd).
    SetMousePos      > This sets the mousecursor to the specified coordinates.
    ShowMouse        > This shows or hides the mousecursor.
    SwapMouse        > This Swaps the mousebuttons or restores them.
    Visible          > This makes the window visible/invisible or checks the state (visible or invisible).
    WinFromPoint     > This gets the hWnd of the window or control currently under the mousepointer.
    Download it here.
    Good Luck!
    Oetje
    oetje@home.nl
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    30
    hey man thans a lot for real, this is really going to help me out. youre a pal. if you need me, email me at goober010@yahoo.com, i dont forget this stuff....
    --> noware <--
    john@wet-online.com

  4. #4
    Fanatic Member
    Join Date
    Feb 2000
    Location
    The Netherlands
    Posts
    715
    NoWare, no thanks. Jop made the class.
    Oetje
    oetje@home.nl
    93606776
    Visual Basic 6, Windows 2000

    Never pet a burning dog

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    30

    help with class

    I have some questions on the class. It really helped a lot, but there are some things that i cant figure out how to do. Like in:

    Public Function FindWinEx(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal param1 As String, ByVal param2 As String) As Long

    What do i put for the handles? I thought it was supposed to return the handle of something, so I dont know what Im supposed to put here. I also dont know what to put for the parameters. If you could I would greatly appreciate anything.

    Thanks
    --> noware <--
    john@wet-online.com

  6. #6
    Guest
    For the FindWindowEx api function:

    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 Sub Command1_Click()
    
        Dim hWin As Long
        hWin = FindWindowEx(0, 0, "SciCalc", "Calculator")
       'hWin = FindWindowEx(0, 0, Classname, Caption)
        If hWin <> 0 Then
            MsgBox "Calculator found"
        Else
            MsgBox "Calculator not found"
        End If
        
    End Sub
    It's a bit more advanced than the regular FindWindow api funciton. Hope that helps a little .

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    30

    Question Thanks, but..

    It does help, and thanks for the clarification. I was online reading about it last night, and I found out more information on it. I would put things like:

    x = FindWindowEx(retval, 0, "ThunderCommandButton", CLng(0))

    and it would return the handle of the first command button that it found, but I cannot figure out how to get any of the other ones. And when I try doing a class such as "Ate32Class", found in AOL instant messenger (which is what im programming for), it would not find it. The whole thing I am trying to do is set the text in an external textbox instead of using the clumsy and inefficient SendKeys function. If you could help me figure out how I can find that, I would be very grateful.

    Thanks
    --> noware <--
    john@wet-online.com

  8. #8
    Guest
    I believe FindWindowEx works from left to right.
    And here is the code you need to Find AIM's textbox:

    Code:
    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)

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    30

    thank you but...

    thanks for that stuff. It works well, and i tweaked it some to get different results, but yet I am still at a dilemma. It returns three handles, the first of which is the actual aim window. I could do this before by just using the caption of the program, but your way is better. The other two handles I dont know what to do with. I use the GetWindowText and put their hWnd values in, but all it returned were either 9s or 5s. And I tried to SetWindowText to set the text box value, and it wouldnt let me. If I am going about this the wrong way please tell me, otherwise I am at a loss.

    Thank you
    --> noware <--
    john@wet-online.com

  10. #10
    Junior Member
    Join Date
    May 2000
    Location
    Posts
    25
    I download the example and try to run it, nothing happen. Could some explain it to me. thank you

  11. #11

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    30

    ?

    are you talking about the one that Matthew Gates wrote? you have to declare all of the API functions first. Just type in the names in API viewer if you ahve it. I dont remmeber which ones they were and I dont have enough time to do it. Be more specific about what you are talking about and I will get back to you later about it....
    --> noware <--
    john@wet-online.com

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