CONST CCHDEVICENAME = 32
CONST CCHFORMNAME = 32
TYPE DEVMODE
dmDeviceName AS STRING * CCHDEVICENAME
dmSpecVersion AS INTEGER
dmDriverVersion AS INTEGER
dmSize AS INTEGER
dmDriverExtra AS INTEGER
dmFields AS LONG
dmOrientation AS INTEGER
dmPaperSize AS INTEGER
dmPaperLength AS INTEGER
dmPaperWidth AS INTEGER
dmScale AS INTEGER
dmCopies AS INTEGER
dmDefaultSource AS INTEGER
dmPrintQuality AS INTEGER
dmColor AS INTEGER
dmDuplex AS INTEGER
dmYResolution AS INTEGER
dmTTOption AS INTEGER
dmCollate AS INTEGER
dmFormName AS STRING * CCHFORMNAME
dmUnusedPadding AS INTEGER
dmBitsPerPel AS LONG
dmPelsWidth AS LONG
dmPelsHeight AS LONG
dmDisplayFlags AS LONG
dmDisplayFrequency AS LONG
END TYPE
DECLARE FUNCTION GetDesktopWindow LIB "user32" ALIAS "GetDesktopWindow" () AS LONG
DECLARE FUNCTION CreateDC LIB "gdi32" ALIAS "CreateDCA" (BYVAL lpDriverName AS STRING _
, BYVAL lpDeviceName AS STRING, BYVAL lpOutput AS STRING, lpInitData AS DEVMODE) AS LONG
DECLARE FUNCTION BitBlt LIB "gdi32.dll" ALIAS "BitBlt" (BYVAL hdcDest AS LONG, BYVAL _
nXDest AS LONG, BYVAL nYDest AS LONG, BYVAL nWidth AS LONG, BYVAL nHeight AS LONG _
, BYVAL hdcSrc AS LONG, BYVAL nXSrc AS LONG, BYVAL nYSrc AS LONG, BYVAL dwRop AS LONG) AS LONG
DIM Bitmap AS QBITMAP, DeskhWnd AS LONG, DeskDC AS LONG
DeskhWnd=GetDesktopWindow()
DeskDC = CreateDC("DISPLAY", "", "", DevThing)
Bitmap.Height=Screen.Height
Bitmap.Width=Screen.Width
BitBlt(Bitmap.Handle,1,1,Screen.Width,Screen.Height,DeskDC,1,1,&HCC0020)
Bitmap.SaveToFile("screenshot.bmp")
|