문제

I'm building a node-webkit app and want to be able to take screenshots of external apps that users are running. Is there a cross-platform (MIT or open source) solution for this? Perhaps there's a C library that can handle this and I can link it in my node app?

Any advice is greatly appreciated.

도움이 되었습니까?

해결책

If you want to use python. python's Wx library you can make it cross platform.

import wx
app = wx.App(False)
s = wx.ScreenDC()
w, h = s.Size.Get()
b = wx.EmptyBitmap(w, h)
m = wx.MemoryDCFromDC(s)
m.SelectObject(b)
m.Blit(0, 0, w, h, s, 0, 0)
m.SelectObject(wx.NullBitmap)
b.SaveFile("screenshot.png", wx.BITMAP_TYPE_PNG) 

It works great. In mac, wx and python both are installed by default. in linux you only need wx to install.In windows you have to install both. you can give it a try. Answer is copied from here

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top