Public Sub TakeScreenshot()
Try
Dim filename As String = System.Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) & "\SS.gif", ScreenSize As Size = New Size(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height), screenGrab As New Bitmap(My.Computer.Screen.Bounds.Width, My.Computer.Screen.Bounds.Height), g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(screenGrab)
g.CopyFromScreen(New Point(0, 0), New Point(0, 0), ScreenSize)
If My.Computer.FileSystem.FileExists(System.Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) & "\SS.gif") Then
My.Computer.FileSystem.DeleteFile(System.Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) & "\SS.gif")
End If
screenGrab.Save(filename, System.Drawing.Imaging.ImageFormat.Gif)
Catch
End Try
End Sub
This is the sub, that will get your screenshot, afterwards use this
TakeScreenshot()
My.Computer.FileSystem.MoveFile(System.Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) & "\SS.gif", System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\SS.gif")
to save your screenshot on your desktop with the name SS.gif