PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • 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)
IMG_DEST = ""
 
// Open report viewer
iDestination(iViewer)
 
// Print image
iPrintImage(sTempName, 0, 0, iPageWidth(), iPageHeight(), iHomotheticDisplay)
iEndPrinting()
 
// Delete temporary file from image
fDelete(sTempName)
Minimum version required
  • Version 17
This page is also available for…
Comments
Click [Add] to post a comment