Results 1 to 5 of 5

Thread: Ocr

  1. #1
    Senior Member
    Join Date
    May 2004
    Posts
    206

    Ocr

    I'm writing a c++ program, and I want it to take a screenshot and run that screenshot through an OCR program, outputting a text file. Is that possible?
    Thanks for any help, I'll need it.
    It is better to die on your feet than to live on your knees.

  2. #2
    King Tutorial-ankhamun
    Join Date
    Jul 2004
    Posts
    897
    We use to use OmniPage Pro on our scanners with good results, not sure if it will work directly from a screen shot. If all else fails you could print out the screen shot and OCR it with a scanner and Omnipage. Try looking in googe for some freeware OCR software.

  3. #3
    Senior Member
    Join Date
    May 2004
    Posts
    206
    Printing and scanning won't work, because I need to check the screen often enough that it needs to be automated.

    I found a program to meet my needs, now I just need to know how to take a screenshot from c++.
    It is better to die on your feet than to live on your knees.

  4. #4
    Priapistic Monk KorpDeath's Avatar
    Join Date
    Dec 2001
    Posts
    2,628
    Do tell what proggy you found that can do that? It may help out some poor sod sometime.

    peace
    Mankind have a great aversion to intellectual labor; but even supposing knowledge to be easily attainable, more people would be content to be ignorant than would take even a little trouble to acquire it.
    - Samuel Johnson

  5. #5
    Senior Member
    Join Date
    May 2004
    Posts
    206
    GOCR

    Also, I came up with this code:

    Code:
    void CaptureScreen()
    {
        int nScreenWidth = GetSystemMetrics(SM_CXSCREEN);
        int nScreenHeight = GetSystemMetrics(SM_CYSCREEN);
        HWND hDesktopWnd = GetDesktopWindow();
        HDC hDesktopDC = GetDC(hDesktopWnd);
        HDC hCaptureDC = CreateCompatibleDC(hDesktopDC);
        HBITMAP hCaptureBitmap =CreateCompatibleBitmap(hDesktopDC, 
            nScreenWidth, nScreenHeight);
        SelectObject(hCaptureDC,hCaptureBitmap); 
        BitBlt(hCaptureDC,0,0,nScreenWidth,nScreenHeight,h  DesktopDC,0,0,SRCCOPY); 
         //Here I need some code to save the image.
        ReleaseDC(hDesktopWnd,hDesktopDC);
        DeleteDC(hCaptureDC);
        DeleteObject(hCaptureBitmap);
    }
    Can someone please fill in the part to save the image?
    It is better to die on your feet than to live on your knees.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •