Solved

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

Posted on 2013-01-14
3
403 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

We were having a lot of "Heartbeat Alerts" in our SCOM environment, now "Heartbeat" in a SCOM environment for those of you who might not be familiar with SCOM is a packet of data sent from the agent to the management server on a regular basis, basic…
Article by: Leon
Software Metering within our group of companies has always been an afterthought until auditing of software and licensing became a pain point. Orchestrator and SCCM metering gave us the answer and it was an exciting process.
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…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …

707 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now