467,926 Members | 1,751 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,926 developers. It's quick & easy.

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
Sep 18 '08 #1
  • viewed: 2050
Share:
4 Replies
Icecrack
Expert 100+
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
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+
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
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.

Similar topics

8 posts views Thread by Xero Limit 126 | last post: by
reply views Thread by Markus Poehler | last post: by
10 posts views Thread by Sorin Dolha [MCSD .NET] | last post: by
16 posts views Thread by bie2 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.