Results 1 to 7 of 7

Thread: getting text off the screen

  1. #1

    Thread Starter
    Fanatic Member mikeycorn's Avatar
    Join Date
    Jun 2000
    Location
    Aliso Viejo, CA, USA
    Posts
    526

    getting text off the screen

    I saw a program that could take a screen shot and take any text off your screen for $19.95. (Before you laugh and say it's stupid to pay twenty bucks for something you could do in a single keystroke, we're talking any text off the screen, including that stuff you can't get a cursor at, like pdf's and aol member directories, for example.)

    Would creating a program like this be as totally massive of an undertaking as it would be to create a scanner ocr program, or does anyone think it could be done with less effort?
    ~ mikeycorn

    With over 45,000 Questions in the User Submitted Database, it's the Most Popular Quiz Creation Software on the Net:

    PEST - The Personal Exam Self-Tester

  2. #2
    Addicted Member
    Join Date
    Jul 2000
    Location
    FeedMeTown, Ohio
    Posts
    176
    Are you serious? 20 bucks? Buy the program and let it go!

  3. #3

    Thread Starter
    Fanatic Member mikeycorn's Avatar
    Join Date
    Jun 2000
    Location
    Aliso Viejo, CA, USA
    Posts
    526
    Good advice then . . . it's not that I'm cheap (although I am slightly poor) but I just would rather program it myself if it's realistically acomplishable.
    ~ mikeycorn

    With over 45,000 Questions in the User Submitted Database, it's the Most Popular Quiz Creation Software on the Net:

    PEST - The Personal Exam Self-Tester

  4. #4
    Addicted Member slashandburn's Avatar
    Join Date
    Aug 1999
    Location
    Marietta, Ga
    Posts
    229

    How to steal the screen.

    How would it steal text from the screen. Would it parse files into text or just what your looking at?

    if you want to steal the text off the screen it would require a whole lot of going through objects handles and retriving text that way, but it would be such a mess.

    Or you could try this function, it can steal text from apps.

    ''start code
    Type POINTAPI 'Declare types
    X As Long
    Y As Long
    End Type
    Declare Function GetCursorPos Lib "user32" _
    (lpPoint As POINTAPI) As Long 'Declare API
    Declare Function WindowFromPoint Lib "user32.dll" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
    Public Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Public Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long

    Public Function get_text_mouse() As String
    On Error GoTo Errore:
    Dim mousepos As POINTAPI
    Dim wintext As String, slength As Long
    Dim hwnd As Long
    Dim retval As Long
    retval = GetCursorPos(mousepos)
    hwnd = WindowFromPoint(mousepos.X, mousepos.Y)
    If hwnd <> 0 Then
    slength = GetWindowTextLength(hwnd) ' get length of title bar text
    wintext = Space(slength + 1) ' make room in the buffer to receive the string
    slength = GetWindowText(hwnd, wintext, slength + 1) ' get the text
    wintext = Left(wintext, slength)
    get_text_mouse = wintext
    Else
    get_text_mouse = ""
    End If
    Errore:
    End Function

    ''end code

    But Here is some code i just found inside of my library, that should grab the screen to a Picturebox.

    Usage : Send it a picture box and it will fill its image with the screen. Note for best results set the pictureboxes size to match the screen.



    '''''Start Code

    Private Declare Function GetDesktopWindow _
    Lib "user32" () As Long

    Private Declare Function GetDC _
    Lib "user32" ( _
    ByVal hwnd As Long) As Long

    Private Declare Function ReleaseDC _
    Lib "user32" ( _
    ByVal hwnd As Long, _
    ByVal hdc As Long) As Long

    Private Declare Function BitBlt _
    Lib "gdi32" ( _
    ByVal hDestDC As Long, _
    ByVal x As Long, _
    ByVal y As Long, _
    ByVal nWidth As Long, _
    ByVal nHeight As Long, _
    ByVal hSrcDC As Long, _
    ByVal xSrc As Long, _
    ByVal ySrc As Long, _
    ByVal dwRop As Long) As Long

    Public sx As Integer
    Public ex As Integer
    Public sy As Integer
    Public ey As Integer


    Public Sub Grabscreen(Picture1 As PictureBox)
    Dim hWindow As Long
    Dim hDContext As Long
    Picture1.AutoRedraw = True
    hWindow = GetDesktopWindow()
    hDContext = GetDC(hWindow)
    BitBlt Picture1.hdc, 0, 0, Screen.Width, Screen.Height, hDContext, 0, 0, vbSrcCopy
    Picture1.Refresh
    ReleaseDC hWindow, hDContext
    End Sub

    ''End Code
    Last edited by slashandburn; Jan 26th, 2002 at 01:04 AM.

  5. #5
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,526
    It is possible to do this with VB and the WIndows API, but it would cost you far, far more than $20 just in research, API books and tools, and time to do it. I'd buy the program. You might post the name of the program and a link to the web site where you found it in case others might find it useful.

  6. #6
    The picture isn't missing BuggyProgrammer's Avatar
    Join Date
    Oct 2000
    Location
    Vancouver, Canada
    Posts
    5,217
    slashandburn, you should do screen.width / 15 and screen.height /15 so it is faster
    Remember, if someone's post was not helpful, you can always rate their post negatively .

  7. #7
    Addicted Member slashandburn's Avatar
    Join Date
    Aug 1999
    Location
    Marietta, Ga
    Posts
    229
    Do you mean a program that could discern text from an image OCR (I think)(Abby Finereader) then buy the darn thing or if you have a scanner check if it came with anything that can do OCR. I know with my scanner i got abby and it never expires, but it is limited.

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