I wonder how the screen recorder and screen capture application capture the window screen.?
As I know How to take Snapshot in this But the question is that their application were minimize/minimize to notify icons....
And by the one click: (F11) screen get capture...
I tried this.
Form1.hide()
notifyicon1.show()... etc etc/....
But i could not manage that When i am unfocus to the form then though How I can capture the screen:

My code to capture the Screen are below:

Public Class Snapshoter

    Private Sub Snapshoter_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
        If e.KeyCode = Keys.F11 Then
            Dim bounds As Rectangle
            Dim screenshot As System.Drawing.Bitmap
            Dim graph As Graphics
            bounds = Screen.PrimaryScreen.Bounds
            screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
            graph = Graphics.FromImage(screenshot)
            graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
            PictureBox1.Image = screenshot
            Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable
            Dim ask As MsgBoxResult
            ask = MsgBox("Want to save image?", MsgBoxStyle.Question & MsgBoxStyle.YesNo, "DM.Question")
            If ask = MsgBoxResult.Yes Then
                SaveFileDialog1.ShowDialog()
            Else
                If ask = MsgBoxResult.No Then
                    PictureBox1.Visible = False
                    PictureBox1.Enabled = False
                End If
            End If
            Me.Close()
        End If

        If e.KeyCode = Keys.F12 Then
            Me.Close()
        End If

    End Sub

    Private Sub Snapshoter_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        MsgBox("Hotkeys:" & vbNewLine & "F11: Snapshot" & vbNewLine & "F12: Exit Snapshoter", MsgBoxStyle.OkOnly, "")
    End Sub

    Private Sub SaveFileDialog1_FileOk(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
        Dim FileToSaveAs As String = SaveFileDialog1.FileName
        PictureBox1.Image.Save(SaveFileDialog1.FileName, System.Drawing.Imaging.ImageFormat.Png)
    End Sub
End Class

Use Timer and Keylogger.
Type this below Public class form 1
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Int32) As Int16

Form1.windwostate must be minimize if not then though it is going to work

Timer Code are Below:

Dim snap As Boolean
snap = GetAsyncKeyState(Keys.F11)
    If snap = True Then
        'Add here the image capture code
        savefiledialog.showdialog()
    End If
Dim snapexiter As Boolean
snapexiter = GetAsyncKeyState(Keys.F12)
    If snapexiter = True Then
        Me.close
    End If

This will work as I am using same code for this

commented: Thanks, I got it +2
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.