Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #7894

Re: Capture part of screen and save to disk (BMP/JPG)

From JohnMartens <martens@tennishulp.info>
Newsgroups comp.lang.clipper.visual-objects
Subject Re: Capture part of screen and save to disk (BMP/JPG)
Date 2015-03-22 18:24 +0100
Organization A noiseless patient Spider
Message-ID <memtpv$a48$1@dont-email.me> (permalink)
References <49962ac6-8b0c-4304-bf0d-d418de8206fb@googlegroups.com>

Show all headers | View raw


I;m using FabPaint and save with this funciotn.

John


_DLL FUNCTION DIBSaveAsJPEG(pWinBmp AS PTR, pszFName AS PSZ) AS VOID 
PASCAL:FabPaint.FabDIBSaveAsJPEG
//p Save a DIB Object to a JPEG file
//a <pWinBMp> Pointer to the DIB Object to save
//a <pszFName> Name of the File to create
//d This function will save the desired DIB Object as a JPEG file.
//d This function only works for 32 bpp bitmaps at the moment, so as an 
internal enhancement it
//d will try to copy the bitmap as 32 bpp if needed before saving.
//d To retrieve the number of bit per pixel, use the DIBGetInfo() 
function, and in the returned structure,
//d read the biBitCount member of the bmiHeader member.
//j FUNCTION:DIBGetInfo



paulus604@gmail.com schreef op 22-3-2015 om 16:44:
> Hello all,
>
> I would like to save a part of a screen/window to a file.
> Using the code below I asume the data is already in memory (tips are welcome).
>
>      // create a DC (device contaxt) for the screen and create
>      // a memory DC compatible to screen DC
>      hScrDC := CreateDC(PSZ(_CAST,"DISPLAY"), NULL_PSZ, NULL_PSZ , NULL_PSZ )
>      hMemDC := CreateCompatibleDC(hScrDC)  //compatible to display device context
>      // get points of rectangle to grab
>      nX := lpRect.Left
>      nY := lpRect.top
>      nX2 := lpRect.right
>      nY2 := lpRect.bottom
>      // get screen resolution
>      xScrn := GetDeviceCaps(hScrDC, HORZRES)
>      yScrn := GetDeviceCaps(hScrDC, VERTRES)
>     //make sure bitmap rectangle is visible
>      IF nX < 0 ; nX := 0; ENDIF
>      IF nY < 0 ; nY := 0; ENDIF
>      IF nX2 > xScrn; nX2 := xScrn; ENDIF
>      IF nY2 > yScrn; nY2 := yScrn; ENDIF
>      nWidth := nX2 - nX
>      nHeight := nY2 - nY
>      // create a bitmap compatible with the screen DC
>      hBitmap := CreateCompatibleBitmap(hScrDC, nWidth, nHeight)
>      // select new bitmap into memory DC
>      hOldBitmap := SelectObject(hMemDC, hBitmap)
>      // bitblt screen DC to memory DC
>      BitBlt(hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY)
>
> What next? How do I save the image.
>
> Thanks for any help
> Paul, Netherlands
>

Back to comp.lang.clipper.visual-objects | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Capture part of screen and save to disk (BMP/JPG) paulus604@gmail.com - 2015-03-22 08:44 -0700
  Re: Capture part of screen and save to disk (BMP/JPG) JohnMartens <martens@tennishulp.info> - 2015-03-22 18:24 +0100
  Re: Capture part of screen and save to disk (BMP/JPG) paulus604@gmail.com - 2015-03-22 13:23 -0700
    Re: Capture part of screen and save to disk (BMP/JPG) JohnMartens <martens@tennishulp.info> - 2015-03-22 21:36 +0100
  Re: Capture part of screen and save to disk (BMP/JPG) paulus604@gmail.com - 2015-03-28 10:22 -0700

csiph-web