Results 1 to 2 of 2

Thread: Getting Text From Another Program

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Ohio
    Posts
    44

    Getting Text From Another Program

    What I'm trying to do is get text inside of a text box in another program. I've tried a bunch of stuff but nothing seems to work,
    i'll either get a response of zero or get nothing.
    Anyone able to Help ?
    VB Code:
    1. Private Sub Command1_Click()
    2.  Dim DRText As String
    3.  
    4. Dim gwintext As String  ' receives the copied text from the target window
    5. Dim glength As Long  ' length of the window text
    6. Dim gretval As Long  ' return value of message
    7.  
    8.  
    9. glength = SendMessage(DRGame, WM_GETTEXTLENGTH, CLng(0), CLng(0)) + 1
    10. gwintext = Space(glength)
    11.  
    12. gretval = SendMessage(DRGame, WM_GETTEXT, ByVal glength, ByVal gwintext)
    13.  
    14. DRText = Left(gwintext, gretval)
    15.  
    16.  Text1.Text = DRText
    17. End Sub
    18.  
    19.  
    20.  
    21. Private Sub Form_Load()
    22. 'Sets Caption for Taskbar Item
    23.  
    24. 'Finds DRTextbox
    25. 'Finds DR
    26. EnumWindows AddressOf EnumWindowsProc, 0
    27. EnumChildWindows DRhwnd, AddressOf EnumChildProc, 0
    28. EnumChildWindows DRhwnd, AddressOf EnumGameProc, 0
    29.  
    30. End Sub

    btw I'm not trying to get the caption of the window but its actualy
    content, Anyone have any ideas ?

  2. #2

    Thread Starter
    Member
    Join Date
    Nov 2001
    Location
    Ohio
    Posts
    44
    Thanks for the reply yapp i'll try out your suggestions. I've been
    having alot of trouble with this problem or at least getting
    others to understand it which results in me getting the same
    code snippets that all do the same thing which i already know
    how to do

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