Screen capture

Screen capture

Post by Mario Pére » Sun, 06 Jun 1999 04:00:00



How can I capture the screen?
I have tried to do so with API copying screen contents into clipboard in
this way:

    HRGN region;
    HDC contexto;
    HWND miwin;

    miwin=0;
    region=CreateRectRgn(1,1,300,300);
    contexto=GetDC(miwin);
    SetClipboardData(CF_BITMAP,region);
    SetClipboardViewer(miwin);

why doesn't it works? what can I do?

Lots of zanks!!!!

Mario Prez

 
 
 

Screen capture

Post by Michael Warn » Sun, 06 Jun 1999 04:00:00




Quote:>How can I capture the screen?

GetDC(0) will give you a device context for the entire screen. Create
a TCanvas and set its Handle to this, and you can use TCanvas mathods
to copy from it to another.

"You may look like we do
 Talk like we do
 But you know how it is
 You're not one of us" - Peter Gabriel

 
 
 

Screen capture

Post by Gary Venni » Sun, 06 Jun 1999 04:00:00


I picked this up somewhere along the line and incorporated it into one
of my apps. It's fast and works just fine.

void __fastcall TEPSForm::CaptureBtnClick(TObject *Sender)
{
// ensure no other form shadows this form
   FormStyle = fsStayOnTop;
   Refresh();
// Create a TCanvas object for the desktop DC.
   TCanvas* dtCanvas = new TCanvas;
   dtCanvas->Handle = GetDC(0);
// Create a new TBitmap object and set its
// size to the size of the form.
   Graphics::TBitmap* bitmap = new Graphics::TBitmap;
   bitmap->Width = Width;
   bitmap->Height = Height;

// Create a palette from the form's Canvas
// and assign that palette to the bitmap's
// Palette property.
   int nColors = GetDeviceCaps(Canvas->Handle, SIZEPALETTE);
   LOGPALETTE* logPal = (LOGPALETTE*)new Byte[sizeof(LOGPALETTE) +
(nColors - 1) *
       sizeof(PALET*TRY)];
   logPal->palVersion  = 0x300;
   logPal->palNumEntries = (Word)nColors;
   GetSystemPalet*tries(Canvas->Handle,0, nColors,
logPal->palPalEntry);
   bitmap->Palette = CreatePalette(logPal);
   delete[] logPal;

// Copy a section of the screen from the
// desktop canvas to the bitmap.
   TRect src = BoundsRect;
   TRect dest = Rect(0, 0, Width, Height);
   bitmap->Canvas->CopyRect(dest, dtCanvas, src);

// Save it to disk.
   char buffer[256];
   GetWindowsDirectory(buffer, sizeof(buffer));
   AnsiString asFileName = FileSearch(ToFileEdit->Text + ".bmp",
         GetCurrentDir() + AnsiString(";") + AnsiString(buffer));
   if (asFileName.IsEmpty())
         bitmap->SaveToFile(ToFileEdit->Text + ".bmp");
   else
        Application->MessageBox("Choose another name","File            
Exists",MB_OK|MB_ICONERROR);
// Clean up and go home.
   delete bitmap;
   delete dtCanvas;
   CaptureBtn->Enabled = true;

}



> >How can I capture the screen?

> GetDC(0) will give you a device context for the entire screen. Create
> a TCanvas and set its Handle to this, and you can use TCanvas mathods
> to copy from it to another.

> "You may look like we do
>  Talk like we do
>  But you know how it is
>  You're not one of us" - Peter Gabriel

 
 
 

1. Sending Screen capture for Corel Capture to Corel OCR-Trace

Hi There,

I would like to capture a text block from an area on screen using Corel
Capture and
send it to Corel OCR-TRACE for OCR'ing. I noticed that only Draw and
PhotoPaint
are seen as OLE enabled.

Is what I want to do possible (I am using v7 software), and if not, does
anybody know
of some software that will allow me to OCR a screen capture.

Thanks in Advance

Andrew Jones


2. New Website Online

3. NEEDED: Screen Capture that does screen savers?!

4. SoQt

5. Updated virtual reality Gallery

6. Screen Capture Startup Screen?

7. Screen capture before screen save problems !

8. Video screen capture

9. Resizing screen captures to create gifs in Paintshop Pro

10. 16 Bit Screen Capture software

11. (Screen) Capture a large Word Picture