Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2013-01-14
3
Medium Priority
?
428 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:Chris H
ID: 38776685
issue an alt+tab or two?
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
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…

926 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