Home | Sign in | English EN
  • Printing the screen where the current window is displayed
WinScreenRectangle (Example)
Printing the screen where the current window is displayed
The following code is used to print the screen where the current window is displayed.
IMG_DEST is an invisible Image control found in the current window
// Temporary name of the image
sTempName is string
sTempName = fTempFile()
// Dimensions of the screen that displays the current window
sInfoCurrentScreen is string
sInfoCurrentScreen = WinScreenRectangle("", screenWithoutTaskbar)
// Result: <X1> + TAB + <Y1> + TAB + <x2> + TAB + <Y2>.
// To print all the screens in multi-screen, you should use the functions:
// SysListScreen(), SysScreenRectangle()
nXScreen, nYScreen, nScreenWidth, nScreenHeight are int
nXScreen = ExtractString(sInfoCurrentScreen, firstRank)
nYScreen = ExtractString(sInfoCurrentScreen, nextRank)
nScreenWidth = Abs(Val(ExtractString(sInfoCurrentScreen, nextRank)) - nXScreen)
nScreenHeight = Abs(Val(ExtractString(sInfoCurrentScreen, nextRank)) - nYScreen)
// Modify the size of the Image control to adapt it to the size of the screen
IMG_DEST..Width = nScreenWidth
IMG_DEST..Height = nScreenHeight
// Copy the screen into the Image control
dCopyBlt(copyScreen, IMG_DEST, copySrcCopy, ...
nXScreen, nYScreen, nScreenWidth, nScreenHeight, 0, 0, nScreenHeight, nScreenWidth)
// Save the image in a temporary file
dSaveImageJPEG(IMG_DEST, sTempName, 90)
// Clears the Image control (frees the memory)
// Open report viewer
// Print image
iPrintImage(sTempName, 0, 0, iPageWidth(), iPageHeight(), iHomotheticDisplay)
// Delete temporary file from image
Minimum version required
  • Version 17
This page is also available for…
Click [Add] to post a comment