🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
3 messages
3 total messages Started by poojo hackma Thu, 26 Oct 2006 14:14
screen to bitmap API
#2975
Author: poojo hackma
Date: Thu, 26 Oct 2006 14:14
4 lines
1118 bytes
I'm looking for an API call that can capture the display of whatever Window 
I have selected, and turn that into a bitmap.

Is such an API out there? 
Re: screen to bitmap API
#2976
Author: Remy Lebeau (TeamB)
Date: Thu, 26 Oct 2006 16:37
12 lines
1155 bytes
"poojo hackma" <poojo.com/mail> wrote in message
news:4540c2b4@newsgroups.borland.com...

> I'm looking for an API call that can capture the display of
> whatever Window I have selected, and turn that into a bitmap.

Simply retreive the HDC for the window and then BitBlt() it into your
bitmap's HDC.


Gambit
Re: screen to bitmap API
#2979
Author: JF Jolin
Date: Thu, 26 Oct 2006 16:55
59 lines
2451 bytes
> Remy Lebeau (TeamB) <no.spam@no.spam.com> wrote:
> news:4540e4bb$1@newsgroups.borland.com...
>
>> Simply retreive the HDC for the window and then BitBlt() it into your
>> bitmap's HDC.
>

Example "Capturing an image" taken from help file.


/*
  * Create a normal DC and a memory DC for the entire screen. The
  * normal DC provides a "snapshot" of the screen contents. The
  * memory DC keeps a copy of this "snapshot" in the associated
  * bitmap.
  */

hdcScreen = CreateDC("DISPLAY", NULL, NULL, NULL);
hdcCompatible = CreateCompatibleDC(hdcScreen);

/* Create a compatible bitmap for hdcScreen. */

hbmScreen = CreateCompatibleBitmap(hdcScreen,
                      GetDeviceCaps(hdcScreen, HORZRES),
                      GetDeviceCaps(hdcScreen, VERTRES));

if (hbmScreen == 0)
     errhandler("hbmScreen", hwnd);

/* Select the bitmaps into the compatible DC. */

if (!SelectObject(hdcCompatible, hbmScreen))
     errhandler("Compatible Bitmap Selection", hwnd);

         /* Hide the application window. */

         ShowWindow(hwnd, SW_HIDE);

         /*
          * Copy color data for the entire display into a
          * bitmap that is selected into a compatible DC.
          */

         if (!BitBlt(hdcCompatible,
                0,0,
                bmp.bmWidth, bmp.bmHeight,
                hdcScreen,
                0,0,
                SRCCOPY))

         errhandler("Screen to Compat Blt Failed", hwnd);

         /* Redraw the application window. */

         ShowWindow(hwnd, SW_SHOW);


__
JF Jolin
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads