Solved

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

Posted on 2013-01-14
3
412 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
3 Comments
 
LVL 16

Expert Comment

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

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 Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
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…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

830 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