Public G_ScreenshotPath As String = System.IO.Path.Combine(G_RuntimePath, "temp.bmp") Dim strPath As String = CaptureScreenToFile(CaptureScreenToImage(True), G_ScreenshotPath) Public Function CaptureScreenToFile(ByVal picImage As Bitmap, Optional ByVal FilePath As String = "") As String 'Get the executables path Dim file_name As String = Application.StartupPath & "\temp.bmp" If FilePath <> "" Then file_name = FilePath End If ' Save the picture as a bitmap, JPEG, or GIF. Try picImage.Save(file_name, System.Drawing.Imaging.ImageFormat.Bmp) Catch Return Nothing Exit Function End Try CaptureScreenToFile = file_name End Function Public Function CaptureScreenToImage(Optional ByVal FullScreen As Boolean = False) As Bitmap ' Captures the current screen and returns as an Image object If FullScreen = True Then ' Print Screen pressed twice here as some systems ' grab active window "accidentally" on first run. SendKeys.SendWait("{PRTSC 2}") 'Pause to let the system catch up: System.Threading.Thread.Sleep(1000) Else SendKeys.SendWait("%{PRTSC}") 'Pause to let the system catch up: System.Threading.Thread.Sleep(1000) End If Dim objData As IDataObject = Clipboard.GetDataObject() Return objData.GetData(DataFormats.Bitmap) End Function