CaptureScreen

The CaptureScreen performs a capture of the data corresponding to a rectangle of pixels from the Windows screen into an active image.

CaptureScreen nXDest, nYDest, nWidth, nHeight, nXSrc, nYSrc

Parameters

nXDest
Specifies the logical x-coordinate of the upper-left corner of the destination rectangle.

nYDest
Specifies the logical y-coordinate of the upper-left corner of the destination rectangle.

nWidth
Specifies the logical width of the source and destination rectangles.

nHeight
Specifies the logical height of the source and destination rectangles.

nXSrc
Specifies the logical x-coordinate of the upper-left corner of the source rectangle.

nYSrc
Specifies the logical y-coordinate of the upper-left corner of the source rectangle.

Remarks

The "active image" means the image currently selected by SelectClipboard calling.

Tip:
Usage this function with ASP is a little tricky, because you have to avoid some NT security violation. To use this function with ASP you should have IIS 4.0 and perform some additional configuration:

  1. Run Web server as serarate process (or virtual directory from that you are going to run ASP capturing script).
  2. In the appropriate MTS package identity, set "Interactive user - the current logged on user" radio button.
  3. Restart your Web service.

Example 1
This VBScript example copies screen area of 640x480 to active image, and creates file named "screen.gif".

set g=CreateObject("shotgraph.image")
xsize=640
ysize=480
g.CreateImage xsize,ysize,256
g.CaptureScreen 0,0,xsize,ysize,0,0
g.BuildPalette 0
g.GifImage -1,0,"screen.gif"

Example 2
This VBScript example copies screen area of 800x600 to active image, reduces it to 640x480 and creates file named "screen.gif".

set g=CreateObject("shotgraph.image")
xsize=640
ysize=480
xssize=800
yssize=600
g.CreateImage xsize,ysize,256
g.InitClipboard xssize,yssize
g.SelectClipboard True
g.CaptureScreen 0,0,xssize,yssize,0,0
g.Stretch 0,0,xsize,ysize,0,0,xssize,yssize,"SRCCOPY","HALFTONE"
g.SelectClipboard False
g.BuildPalette 0
g.GifImage -1,0,"screen.gif"