Results 1 to 3 of 3

Thread: Can I do this?

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    1

    Post

    I have made a text encryption program and am very happy with the result. It uses a simple encryption schyme of turning each character into ascii, adding a predefined number, and then converting it back to a character.

    What I need help on is making it able to read and, if possible, manipulate text boxes from other programs (ie. AOL Instant Messanger). I know how to find each program (FindWindow API) but am stumped on how to do the rest. People have told me that it's possible but i dunno. Any help would be appreciated.


    -contortix

  2. #2
    Guest
    Here is how to get the text from other Windows:

    Code:
    Type POINTAPI
    X As Long
    Y As Long
    End Type
    
    Declare Function GetCursorPos Lib "user32" _
    (lpPoint As POINTAPI) As Long
    Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As Long
    Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Public Declare Function WindowFromPointXY Lib "user32" Alias "WindowFromPoint" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
    
    
    Function GetCaption(hWnd)
    hwndLength% = GetWindowTextLength(hWnd)
    hwndTitle$ = String$(hwndLength%, 0)
    a% = GetWindowText(hWnd, hwndTitle$, (hwndLength% + 1))
    
    GetCaption = hwndTitle$
    End Function
    
    Private Sub Timer1_Timer()
    Dim pnt As POINTAPI
    MousePointer = 0
    GetCursorPos pnt
    yhwnd% = WindowFromPointXY(pnt.X, pnt.Y)
    Text1.text = GetCaption(yhwnd%)
    End Sub
    Or you could get every caption off of every window.

    Code:
    '^API^ needed
    For i = 1 To 10000
    X = GetCaption(i)
    List1.AddItem X
    Next
    Hope that helps a little.

  3. #3
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810

    Smile

    I suggest that you do some reading about DDE.

    Dynamic Data Exchange, can link two applications and transfer data between (read & write), picture boxes, text boxes & labels.

    See the VB files for sample code.

    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

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