1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
| ;@author Progi1984
ProcedureDLL Desktop_MakeScreenshot(Filename.s)
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Linux ;{
Protected lProgram.l
RunProgram("import", "-silent -window root "+GetFilePart(Filename), GetPathPart(Filename))
;}
CompilerCase #PB_OS_Windows ;{
Protected lImage.l
Protected hDC.l
lImage = CreateImage(#PB_Any, GetSystemMetrics_(#SM_CXSCREEN),GetSystemMetrics_(#SM_CYSCREEN))
hDC = StartDrawing(ImageOutput(lImage))
BitBlt_(hDC,0,0,ImageWidth(lImage),ImageHeight(lImage),GetDC_(GetDesktopWindow_()), 0, 0, #SRCCOPY)
StopDrawing()
ReleaseDC_(GetDesktopWindow_(), hDC)
SaveImage(lImage, Filename)
;}
CompilerEndSelect
EndProcedure
Desktop_MakeScreenshot(GetHomeDirectory() + "file.jpg")
|