?
Solved

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

Posted on 2013-01-14
3
Medium Priority
?
424 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 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

Many companies are making the switch from Microsoft to Google Apps (https://www.google.com/work/apps/business/). Use this article to learn more about what Google Apps has to offer and to help if you’re planning on migrating to Google Apps. It is …
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Viewers will learn how to maximize accessibility options in an Excel workbook for users with accessibility issues.
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…

719 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