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

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

  
'From: Corsaronero0  Wed Jan 29, 2003  9:17 pm

' 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

' Simple full-screen capture utility

     $TYPECHECK ON
     $INCLUDE "RAPIDQ.INC"
     $INCLUDE "Win32api.inc"

     DIM DC AS INTEGER
'here I got thie errore message
' Identifier BITMAP already used, try another name
' so we carefully put out the final "p"
     DIM Bitma AS QBITMAP

     Bitma.Width = Screen.Width
     Bitma.Height = Screen.Height
     Bitma.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(Bitma.Handle, 0, 0, Screen.Width, Screen.Height, DC, 0, 0, SrcCopy)
     ReleaseDC(0,DC)

     Bitma.SaveToFile("CAPTURE.BMP")

     CREATE Form AS QFORM
      CAPTION = "Saved as CAPTURE.BMP"
      CREATE Image AS QIMAGE
       AutoSize = 1
       BMP = Bitma.BMP
      END CREATE
      Center
      SHOWMODAL
     END CREATE
掌柜推荐
 
 
¥477.00 ·
 
 
¥918.00 ·
 
 
¥370.00 ·
 
 
¥271.00 ·
 
 
¥995.00 ·
 
 
¥1,580.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:46:55