Easy way for user to kill an executable file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Perl Beginner
    New Member
    • Sep 2007
    • 57

    #1

    Easy way for user to kill an executable file?

    i have created an automation program using Perl (Win32). i converted the perl script to an executable file. what i would like to do is have a way for the user to easily kill the executable file if necessary. for instance, have a button somewhere on the desktop that they can just click it and the executable will stop. Or inset some lines of code that would specify a 'button' sequence that the user can press on the keyboard that would trigger the executable to stop. Is this possible? i have no code to post because I have no idea where to start!

    At this point, in order to stop the executable, i have to press CTRL-ALT-DEL, go to task manager and stop the process.

    Help please!
    Terra
  • Icecrack
    Recognized Expert New Member
    • Sep 2008
    • 174

    #2
    it really depends on how you are running this perl code, you can try CTRL + C ?????

    Note: i do know this was 6 days old

    Comment

    • Perl Beginner
      New Member
      • Sep 2007
      • 57

      #3
      thanks for your input. however, CTRL-C only works if i run it as a Perl script (*.pl). if i convert it to an executable (*.exe), CTRL-C doesn't work.

      Comment

      • Icecrack
        Recognized Expert New Member
        • Sep 2008
        • 174

        #4
        Originally posted by Perl Beginner
        thanks for your input. however, CTRL-C only works if i run it as a Perl script (*.pl). if i convert it to an executable (*.exe), CTRL-C doesn't work.

        you can look at this module



        if you can reprogram your code, then i will add the above and look for a shortcut(hotkey ) to quit the program.

        try something like this:

        Code:
        ReadMode 4, IN;
        $k = "";
        $in = \*IN; # or *IN or "IN" 
        while($k ne \cq)  # Looks for Control + q
        {
         while !defined($k=ReadKey(-1, $in));
        
        #Run Code Here
        
        }
        
        ReadMode 0, IN;

        Comment

        • Perl Beginner
          New Member
          • Sep 2007
          • 57

          #5
          Thanks! I'll take a look at this!
          Terra

          Comment

          Working...