Solved

how to exit the program without using the mouse in vb.net

Posted on 2013-01-14
3
419 Views
Last Modified: 2013-01-16
I have a little program in vb.net that would  automate mouse click at certain coordinate on the screen that I use for a game.  The problem that I'm having is how to stop this program.  once it runs, I just can't stop it, I had to do CTRL ALT DEL to kill it.  

I was trying to use this

Private Sub form1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.KeyCode = Keys.F1 Then
            Timer1.Start()
        Else
            If e.KeyCode = Keys.F2 Then
                Timer1.Stop()
            End If
        End If
    End Sub

but it turns out that the mouse need to be on the form for these keyboard to work.  Is there a way I can accomplish this without having to move the mouse to the form?
0
Comment
Question by:Paulmkt
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 16

Expert Comment

by:choward16980
ID: 38776685
issue an alt+tab or two?
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 250 total points
ID: 38776934
"Is there a way I can accomplish this without having to move the mouse to the form?"

Yes.  Either register a hotkey with the application, or utilize a low level keyboard hook.
0
 

Expert Comment

by:GangnamStyle
ID: 38777294
Call Application.Exit
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The canonical version of this article is on my web site here: http://iconoun.com/articles/collisions/ A companion presentation is available here: http://iconoun.com/articles/collisions/Unicode_Presentation.pdf
The new Microsoft OS looks great, is easier than ever to upgrade to, it is even free.  So what's the catch?  If you don't change the privacy settings, Microsoft will, in accordance with the (EULA) you clicked okay to without reading, collect all the…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Suggested Courses

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question