Domanda

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.

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top