Purpose
Take SAP GUI Screenshots with GuiXT and a VB.NET DLL

This tip describes how to use a custom VB.NET class library in combination with GuiXT to take screenshots of your current SAP GUI screen. Screenshots can be full screen or a defined area, and are especially helpful for documentation and user support.

The screenshot can also be displayed immediately on the screen using a standard Image command in GuiXT.

Example usage

GuiXT
callvb GuiXTscreenshot.utilities.SaveScreenshot _ 
	filename:="C:\temp\sapscreen.png" _
	x:=50 y:=420 width:=600 height:=300	
			
  • filename: Path and name of the PNG file
  • x, y, width, height: Area coordinates. If omitted or set to -1, full screen is captured.

Display the image in SAP GUI:

GuiXT
Image (3,101.7) (25.9,207.1) "C:\temp\sapscreen.png" _ 
	-plain -nobuffer -noStretch
				
			

Example

As a simple example, we use the standard SAP demo report GFW_PROG_PRES_SHOW_MULT, which generates charts in the SAP GUI. We take a screenshot of one of the charts (e.g. the lower-left), save the image file, and reinsert it into the screen using a GuiXT command for testing purposes.



Available parameters of SaveScreenshot

Parameter Type Optional? Default Description
filename String No - Path to save the PNG screenshot
waitms Integer Yes 0 Wait time before capture, in milliseconds
quickmode Integer Yes 1 Skip window preparation if set to 1 (faster)
x, y Integer Yes -1 Start coordinates of the area. -1 = full screen
width, height Integer Yes -1 Size of the capture area. -1 = full screen
repeat Integer Yes 3 Retries the screenshot to ensure stability
excludeStatusbar Boolean Yes False If true, removes the status bar area from the screenshot

Download project files
You can download the complete VB.NET project with source-code here:
📦 Download GuiXT Screenshot VB.NET Project (ZIP)

Download the DLL
You can download the compiled DLL here:
📦 Download GuiXT Screenshot DLL (ZIP)

Hint: After downloading, right-click the DLL file, choose Properties, and click Unblock in the General tab. This step is needed because Windows may block files downloaded from the internet.