Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27346

Detect Key Press while Form is minimized (Visual Studio 2012)

$
0
0
Hi everyone, I can't find the way to detect when a key is pressed while the form is minimized, help please?

I got this piece of code:
Code:

Private Sub Form1_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
        If e.KeyCode = Keys.Escape Then
            Timer1.Stop()
            MsgBox("Auto Typer stopped", 0, "Auto Typer stopped")
            Button4.BackColor = Color.Lime
            Button4.Text = "START"
            Me.WindowState = System.Windows.Forms.FormWindowState.Normal
        End If
    End Sub

This works when the Form is focused on the screen, but it stops working if i minimize the form.

Thanks!

Viewing all articles
Browse latest Browse all 27346

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>