Skip to content

Get Window Text

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #190920
    Admin
    Administrator

    This is my code that i have so far. what wrong with it. i want to get the text in notepad and put in in the text box of my form.

    Private Sub Command1_Click()
    Dim notepad As Long, editx As Long
    notepad = FindWindow("notepad", vbNullString)
    editx = FindWindowEx(notepad, 0&, "edit", vbNullString)
    Dim TheText As String, TL As Long
    TL = SendMessageLong(editx, WM_GETTEXTLENGTH, 0&, 0&)
    TheText = String(TL + 1, " ")
    Call SendMessageByString(editx, WM_GETTEXT, TL + 1, TheText)
    TheText = Left(TheText, TL)
    End Sub
    #190921
    Departure
    Member

    You proberly did’nt declare the functions and const’s for Findwindow, FindwindowEX, sendmessageLong, Sendmessagebystring and the consts WM_GETTEXTLENGTH, WM_GETTEXT

    Ohh and it could be that I dont see anywhere in that function where the text is sent to, for example a msgbox or a textbox ect…

    To be honest this looks to be a simple copy and paste code from a spy viewer, and it looks very much like PAT or JK API spy app. If you can’nt see the basics of that code why even try? your best starting with basic stuff and working your way up to understanding VB code, Dont try and bite off more than you can chew, and do some more reading it will help you.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.