Guidance
指路人
g.yi.org
software / rapidq / Examples / Graphics & Animation / capture / capture.bas

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
' Simple full-screen capture utility

     $TYPECHECK ON
     $INCLUDE "RAPIDQ.INC"

     CONST SRCCOPY = &HCC0020
     CONST SRCPAINT = &HEE0086
     CONST SRCAND = &H8800C6
     CONST SRCINVERT = &H6600460
     CONST SRCERASE = &H1100A6
     CONST NOTSRCCOPY = &H330008
     CONST NOTSRCERASE = &H1100A6
     CONST MERGECOPY = &HC000CA
     CONST MERGEPAINT = &HBB0226
     CONST PATCOPY = &HF00021
     CONST PATPAINT = &HFB0009
     CONST PATINVERT = &H5A0049
     CONST DSTINVERT = &H550009
     CONST BLACKNESS = &H000042
     CONST WHITENESS = &HFF0062

     DECLARE FUNCTION SetActiveWindow LIB "USER32" ALIAS "SetActiveWindow" (hWnd AS INTEGER) AS INTEGER
     DECLARE FUNCTION GetDC LIB "USER32" ALIAS "GetDC" (hWnd AS INTEGER) AS INTEGER
     DECLARE FUNCTION ReleaseDC LIB "USER32" ALIAS "ReleaseDC" (hWnd AS INTEGER, hDC AS INTEGER) AS INTEGER
     DECLARE FUNCTION BitBlt LIB "GDI32" ALIAS "BitBlt" _
      (BYREF hDC AS INTEGER, nXDest AS INTEGER, nYDest AS INTEGER, _
      nWidth AS INTEGER, nHeight AS INTEGER, hdcSrc AS INTEGER, _
      nXSrc AS INTEGER, nYSrc AS INTEGER, dwRop AS INTEGER) AS INTEGER

     DIM DC AS INTEGER
     DIM Bitmap AS QBITMAP

     Bitmap.Width = Screen.Width
     Bitmap.Height = Screen.Height
     Bitmap.PixelFormat = pf24bit     '-- Adjust as needed

     SetActiveWindow(0)
     DC = GetDC(0)
'-- You might want to check the return value of BitBlt, if 0, then it failed
     BitBlt(Bitmap.Handle, 0, 0, Screen.Width, Screen.Height, DC, 0, 0, SrcCopy)
     ReleaseDC(0,DC)

     Bitmap.SaveToFile("CAPTURE.BMP")

     CREATE Form AS QFORM
      CAPTION = "Saved as CAPTURE.BMP"
      CREATE Image AS QIMAGE
       AutoSize = 1
       BMP = Bitmap.BMP
      END CREATE
      Center
      SHOWMODAL
     END CREATE
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Sun 2023-1-29  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:46:55