2015-12-30 30 views
0

我的工作正在进行中4GL的,在我的应用我想采取无按键事件,例如(CTRL + F9)的活动窗口的screeenshot并将其保存在一个预先确定的夹。任何人都可以帮助我吗?截图活动窗口进展-4GL

+0

这与其他问题类似,可以使用.NET执行:http://stackoverflow.com/questions/362986/capture-the-screen-into-a-bitmap –

+0

可能的重复[捕获屏幕到位图](http://stackoverflow.com/questions/362986/capture-the-screen-into-a-bitmap) –

回答

0

正如在评论中提到的,这可以通过从Progress ABL调用.NET来完成。这里有一个截屏整个屏幕的例子。您需要根据自己的需求进行调整。

USING System.Drawing.*. 
USING System.Drawing.Imaging.*. 
USING System.Windows.Forms.Screen. 

DEFINE VARIABLE bmpScreenshot AS Bitmap NO-UNDO. 
DEFINE VARIABLE gfxScreenshot AS Graphics NO-UNDO. 

bmpScreenshot = NEW Bitmap(Screen:PrimaryScreen:Bounds:Width, 
          Screen:PrimaryScreen:Bounds:Height, 
          PixelFormat:Format32bppArgb). 

gfxScreenshot = Graphics:FromImage(bmpScreenshot). 

gfxScreenshot:CopyFromScreen(Screen:PrimaryScreen:Bounds:X, 
          Screen:PrimaryScreen:Bounds:Y, 
          0, 
          0, 
          Screen:PrimaryScreen:Bounds:Size, 
          CopyPixelOperation:SourceCopy). 

/* Use ImageFormat:[Png|Gif|Bmp|Tiff] etc for different image formats */ 
bmpScreenshot:SAVE("c:\temp\Screenshot.png", ImageFormat:Png). 

这是一个C#到ABL翻译this question on SO