Ruby:窗口打印屏幕win32API调用

时间:2012-05-18 19:05:46

标签: ruby

当您按下alt +打印屏幕时(至少在Windows中),您会获得当前活动(和可见?)窗口的屏幕截图。

如何使用win32Api调用来调用它?

1 个答案:

答案 0 :(得分:0)

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")