Jareds411
September 15th, 2004, 11:11 PM
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. ;)
Irongeek
September 15th, 2004, 11:38 PM
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.
Jareds411
September 15th, 2004, 11:59 PM
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++.
KorpDeath
September 16th, 2004, 02:20 AM
Do tell what proggy you found that can do that? It may help out some poor sod sometime.
peace
Jareds411
September 16th, 2004, 02:24 AM
GOCR (http://jocr.sourceforge.net/ )
Also, I came up with this 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? :rolleyes: :D