Here's some code I "borrowed" from Calvin Hsia's blog that will do a screen
capture. If you have other apps open, you'll have to minimize them before
doing the screen capture, but that's not that difficult.
* stolen from Calvin Hsia's Blog!
* Well borrowed anyway
* John Harvey
*
* set procedure to screenscrape additive
*scrnscrape()

PROCEDURE ScrnScrape()
_screen.WindowState=1
DECLARE integer Sleep IN WIN32API integer
 sleep(3000)      
 
      CLEAR
      TRY 
            cFileName="c:\temp.jpg"
            ERASE (cFileName)
            SET CLASSLIB TO HOME()+"ffc\_gdiplus" addi
            LOCAL og as gpgraphics
            LOCAL oImage as gpimage
            x=0 && adjust these coordinates
            y=0
            w=1260
            h=1020
            oImage=GetRegion(0,x,y,w,h)   
            og=CREATEOBJECT("gpgraphics")
            og.CreateFromImage(oImage)
*            og.DrawImageScaled(oImage,0,0,100,100)
            oImage.SaveToFile(cFileName,"image/jpeg")
            oImage=CREATEOBJECT("gpimage","c:\temp.jpg")
            og.CreateFromHWND(_screen.HWnd)
            og.DrawImageAt(oImage,0,0)
            oImage.SaveToFile(cFileName,"image/jpeg")
      CATCH TO oerr
            ?oerr.message
      ENDTRY
      fDoingScrape=.f.
_screen.WindowState= 2
! explorer c:\temp.jpg
      RETURN 

PROCEDURE GetRegion(hWnd as Integer, nLeft as Integer, nTop as Integer,
nWidth as Integer, nHeight as Integer)
      LOCAL hdc, hbSave, hdcCompat, hbm
      DECLARE integer GetDC IN user32 integer hWnd
      DECLARE integer ReleaseDC IN user32 integer hWnd, integer hDC
      DECLARE integer CreateCompatibleDC IN gdi32 integer hDC
      DECLARE integer CreateCompatibleBitmap IN gdi32 integer hDC, integer
Width, integer Height
      DECLARE integer SelectObject IN gdi32 integer hdc, integer
      DECLARE integer DeleteObject IN gdi32 integer hdc, 
      DECLARE integer BitBlt IN gdi32 integer hdc, integer nXDest, integer
nYDest, integer nWidth, integer nHeight, ;
            integer hdcSrc, integer nXSrc, integer nYSrc, integer nRop
      DECLARE INTEGER GdipCreateBitmapFromHBITMAP in gdiplus integer
hbm,integer hpal,integer @ bitmap
      DECLARE INTEGER GdipCloneBitmapAreaI in gdiplus integer X,integer
Y,integer Width,integer Height,integer enumPixelFormats_format,integer
srcBitmap,integer @ dstBitmap
SRCCOPY   =          0x00CC0020 && from wingdi.h /* dest = source
*/
      LOCAL og as gpgraphics,ofont as gpfont,nBitMap, nTemp
      og=CREATEOBJECT("gpgraphics")
      og.CreateFromHWND(_screen.HWnd)
      oImage=CREATEOBJECT("gpimage")
      hdc = GetDC(hWnd)
      hdcCompat = CreateCompatibleDC(hDC)
      hbm = CreateCompatibleBitmap(hDC, nWidth, nHeight)
      hbSave=SelectObject(hdcCompat,hbm)
      BitBlt(hdcCompat,0,0,nWidth,nHeight,hdc, nLeft, nTop, SRCCOPY)
      SelectObject(hdcCompat, hbSave)
      nBitMap=0
      GdipCreateBitmapFromHBITMAP(hbm,0, @nBitMap)
      nTemp=0
      GdipCloneBitmapAreaI(0,0,nWidth, nHeight, 0, nBitMap, @ntemp)
      oImage.SetHandle(nTemp)
      DeleteObject(hbm)
      ReleaseDC(hWnd, hdcCompat)
      ReleaseDC(hWnd, hDC)
RETURN oImage

 




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL 
PROTECTED]@shelbynet.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to