現在、デスクトップのスクリーンショットを作成する次の VB.NET コードがありますが、アクティブな画面の写真しか撮れません。
Public Function SaveScreen(ByVal theFile As String) As Boolean
Try
SendKeys.Send("%{PRTSC}") '<alt + printscreen>
Application.DoEvents()
Dim data As IDataObject = Clipboard.GetDataObject()
If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then
Dim bmp As Bitmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Bitmap)
bmp.Save(theFile, Imaging.ImageFormat.Png)
End If
Clipboard.SetDataObject(0) 'save memory by removing the image from the clipboard
Return True
Catch ex As Exception
Return False
End Try
End Function
次のコードは、上記の関数を実行する方法です。違いがある場合は、そうではないと思います。
SaveScreen("C:\Lexer_trace\screen.png")
ここで、フォーカスされたウィンドウだけでなく、画面全体の写真を撮れるようにする必要があります。どうすればいいですか?
前もって感謝します、
ローガン