Im shure this will do the trick for many people.
VB Code:
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer) Private Const VK_SNAPSHOT As Short = &H2Cs Public Function SaveScreen(ByVal theFile As String) As Boolean Dim data As IDataObject data = Clipboard.GetDataObject() Dim bmap As Bitmap If data.GetDataPresent(GetType(System.Drawing.Bitmap)) Then bmap = CType(data.GetData(GetType(System.Drawing.Bitmap)), Bitmap) Me.PictureBox1.Image = bmap Me.PictureBox1.Image.Save(theFile, Imaging.ImageFormat.Jpeg) End If End Function Private Sub Command2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Command2.Click Call keybd_event(System.Windows.Forms.Keys.Snapshot, 0, 0, 0) System.Threading.Thread.Sleep(200) ' To have time to catch the clipboard SaveScreen("c:\test.jpg") End Sub




Reply With Quote