当您按下 alt+printscreen(至少在 Windows 中)时,您将获得当前活动(并且可见?)窗口的屏幕截图。
如何使用 win32Api 调用来调用它?
怎么样Win32::Screenshot
?
https://github.com/jarmo/win32screenshot
gem install win32screenshot
require 'win32/screenshot'
# Take a screenshot of the foreground
Win32::Screenshot::Take.of(:foreground).write("image.png")
# Take a screenshot of the window with the specified title
Win32::Screenshot::Take.of(:window, :title => "Abc").write("image.bmp")