Ho trovato quel codice da qualche parte e lo trovo molto utile ma mi piacerebbe trovare un modo per farlo funzionare in modo da catturare solo l'obiettivo della finestra data. Forse con un ID processo o Nome finestra. Anche se quella finestra non è attiva.VB.NET Cattura schermata finestra (ALT + PRINTSCREEN)
Non voglio rendere attiva quella finestra ma voglio ottenere una cattura dello schermo come se stessi facendo Alt + PrintScreen su di esso.
Ecco il codice che funziona per la piena Screen Capture
Private bmpScreenShot As Bitmap
Private gfxScreenshot As Graphics
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)
bmpScreenShot.Save(fileName, ImageFormat.Png)
Io uso il Visual Basic 2008 Express
Grazie in anticipo!
possibile duplicato del [Cattura screenshot della finestra attiva?] (Http://stackoverflow.com/questions/1163761/capture-screenshot-of-active-window) – sloth