SaveScreenShot

SaveScreenShot is a built-in function that takes a screen shot of a project screen and then saves it as an image file.

Function Group Execution Windows Embedded Thin Client Mobile Access
SaveScreenShot Graphic Synchronous Supported Supported Executed on Server Not supported

Syntax

  SaveScreenShot(optStrScreenName,optStrOutputFile,optNumFormat)  
Web Studio Help ions graphic savescreenshot.xml d411357e135 SaveScreenShot
optStrScreenName
The file path and name of a project screen file (*.scr). If no file path is specified, the file must be located in the Screen sub-folder of the project folder (e.g., […]DocumentsInduSoft Web Studio v7.1 ProjectsprojectnameScreenscreenname.scr).

For projects running on Windows (using InduSoft Web Studio) and Windows Embedded Standard (using EmbeddedView), the screen may be either open or closed. For projects running on Windows Embedded Compact (using CEView), the screen must be open.

This parameter is optional; if no value (or "") is specified, the currently open and active screen is used.

optStrOutputFile
The name of the output file. If no file path is specified, the file is saved in the Web sub-folder of the project folder (e.g., […]DocumentsInduSoft Web Studio v7.1 ProjectsprojectnameWebscreenname.jpg)

This parameter is optional; if no value is specified, either the value of optStrScreenName or simply ScreenShot.jpg is used.

optNumFormat
The format of the image file:
Value Description
0 BMP
1 JPG
2 PNG
3 GIF
4 TIFF
5 Auto

This parameter is optional; if no value is specified, the default is 1 (JPG).

Returned value

This function returns the following possible values:
Value Description
0 Success.
-1 Wrong number of parameters.
-2 Wrong parameter types.
-3 Invalid directory.
-4 Second parameter cannot be empty.
-5 Wrong format / invalid option for third parameter.
-6 Failed to save file.
-7 Failed to create compatible bitmap.
-10000 Project is not running. (This typically happens when you try to use the function in the Database Spy.) See note.

Notes

For this function to be executed properly, the project must be running and the Viewer task must be started. The function can be called by background tasks (i.e., Script and Math worksheets) or in the Database Spy, but it will fail if the Viewer task is not also started. This is because the Viewer task is needed to render the screen. For more information about starting run-time tasks, see Execution Tasks dialog.

Examples

Take a screen shot of the current screen, and then save it as ScreenShot.jpg:
  SaveScreenShot()  
Take a screen shot of main.scr, and then save it as main.jpg:
  SaveScreenShot("main.scr")  
Take a screen shot of the current screen, and then save it as a bitmap with the name of the currently logged user:
  SaveScreenShot("",UserName,0)  

SaveScreenShot