guiGrabScreenshot (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

NX-400

Firmware version:

1.00.00


This function grabs a screenshot of the display and saves it to a file.

The screenshot is saved as a gzipped portable graymap format file(pgm), which can then be converted to more common formats on the PC.

Some image manipulating programs such as GIMP(https://www.gimp.org/) supports gzipped pgm files directly, while others requires it to be extracted first, which can be done e.g. with 7zip(http://www.7-zip.org/). To convert from pgm to more common image formats, it is possible to use e.g. http://www.xnview.com/en/xnconvert/.

 

This function can also be called while using the display API.

The screenshots can be useful for e.g. documentation.

 

Note: Menus can not be captured with this function.

 

Input:

filename : STRING

The filename to save the image to.

format : SINT default 0

The format to use when saving the image. Currently only gzipped portable graymap (format:=0) is supported.

 

 

Returns: INT

28

- Unknown file system error.

23

- Media is write protected.

16

- Media is not present.

7

- Media is full.

6

- A file with the same name already exists.

5

- File not found.

4

- Invalid file name.

3

- Path was not found.

1

- Media not open.

0

- Success.

-1

- Display is turned off.

-3

- Invalid format.

-11

- Not supported.

 

Declaration:

FUNCTION guiGrabScreenshot : INT;
VAR_INPUT
  filename : STRING;
  format   : SINT := 0;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
PROGRAM test;
VAR
  rc : INT;
END_VAR;
 
BEGIN
  ...
  // Save screenshot to B:\screen.gz
  rc := guiGrabScreenshot(filename := "B:\screen.gz");
  ...
END;
END_PROGRAM;