Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Prevent Users from Exiting Windows Script

by Dru (Hermit)
on Oct 28, 2005 at 15:51 UTC ( [id://503697]=perlquestion: print w/replies, xml ) Need Help??

Dru has asked for the wisdom of the Perl Monks concerning the following question:

Fellow Monks,

Is anyone aware of a way to prevent users from using the "X" or close button in a DOS screen to keep them from exiting a script prematurely? I guess I also need to account for a ctrl+C, but I should be able to catch those and ignore them. If I could hide the top bar of the DOS window, that should be enough. I am not using any kind of gui manager, just ActiveState's Perlapp to convert the script into a .exe.

Thank you for any suggestions,
Dru
  • Comment on Prevent Users from Exiting Windows Script

Replies are listed 'Best First'.
Re: Prevent Users from Exiting Windows Script
by inman (Curate) on Oct 28, 2005 at 16:53 UTC
    Using wperl as the executable avoids the open DOS window issue. The user can still go into the task manager and kill your app if they have appropriate rights but this is generally harder to do. Running your app as a service may also be worth considering.
Re: Prevent Users from Exiting Windows Script
by pg (Canon) on Oct 28, 2005 at 17:35 UTC

    If you are writing some appliction with Win32::GUI, then you can just turn off controlbox:

    use Win32::GUI; $main=Win32::GUI::Window->new(-width => 400, -height => 200, -controlb +ox => 0); $main->Show(); Win32::GUI::Dialog();

    This will show you a window without close button, minimize button or maximize button.

Re: Prevent Users from Exiting Windows Script
by calin (Deacon) on Oct 28, 2005 at 16:44 UTC

    Here are some suggestions.

    • Use thumb-tacks so even if they push the "X" the window won't go away.
    • Handcuff them. In severe recalcitrant cases you may have to resort to a straitjacket.
    • Unplug the rat.
    • Glue their hands to the keyboard.
    • Use persuasion / threats. This is the "soft" solution!

    Seriously, why? The users should be held responsible for their actions and damage they do on the computer. Conversely, they shoud be able to terminate a program if they judge it's necessary. You're dealing with sentient human beings, not baboons, right?

      If we were dealing with baboons then we would probably be better off. Instead we are dealing with humans who think that opening an attachment that promises to be a picture of 'Anna Kournikova' is a good idea. If 'sentient human beings' didn't mess around as much as they do then computer helpdesks wouldn't have half the work that they do.

      I imagine that Dru is wanting to run a startup script or similar that performs a useful sys-admin task that he doesn't want users to cancel.

Re: Prevent Users from Exiting Windows Script
by sh1tn (Priest) on Oct 28, 2005 at 16:55 UTC
    This is operating system and not programming language issue. You should create restricted profiles. And maybe process which starts console with administrative execution right so that it cannot be killed from 'mortal' users. You may want to take a look at autoIt.


Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://503697]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-25 05:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found