Results 1 to 3 of 3

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

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2013
    Location
    Spain
    Posts
    44

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

    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!

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,413

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


  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2013
    Location
    Spain
    Posts
    44

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

    Quote Originally Posted by .paul. View Post
    Thanks! I've found the solution!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width