By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,374 Members | 2,014 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,374 IT Pros & Developers. It's quick & easy.

Easy way for user to kill an executable file?

P: 57
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
Sep 18 '08 #1
Share this Question
Share on Google+
4 Replies


Icecrack
Expert 100+
P: 174
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
Sep 24 '08 #2

P: 57
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.
Oct 1 '08 #3

Icecrack
Expert 100+
P: 174
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

http://search.cpan.org/dist/TermReadKey/ReadKey.pm

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:

Expand|Select|Wrap|Line Numbers
  1. ReadMode 4, IN;
  2. $k = "";
  3. $in = \*IN; # or *IN or "IN" 
  4. while($k ne \cq)  # Looks for Control + q
  5. {
  6.  while !defined($k=ReadKey(-1, $in));
  7.  
  8. #Run Code Here
  9.  
  10. }
  11.  
  12. ReadMode 0, IN;
  13.  
Oct 1 '08 #4

P: 57
Thanks! I'll take a look at this!
Terra
Oct 2 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.