views:

1038

answers:

7

Is there Any way to handle the crtl + Alt + Del Key combination. Take for instance in a quiz application (Win Forms ), the user should not be able to switch to other windows till the test is over.

I'm able to capture the ctrl and alt key strokes individually, using c# standard properties. but once they user hits the del key . The control goes out of my appliation and windows handles it.

Any thoughts would be helpful.

thanks.

+2  A: 

I don't think this is a good approach.

You are developing an application for the user and should not try to hinder his general actions.

For Alt+Ctrl+Del key combination read this article.

rahul
if that is the case , all online students taking up the test , can get the answer from google(by changing to browser).
vijaysylvester
They can use another machine or use a book also to get the answers.
rahul
Access to another machine or a book can be handled. Not blocking Ctrl-Alt-Del and allowing them to run a browser instance is making it way too easy.
Jim
Would it not be handier to somehow disable the browser(s) on the machines that the test will be running on? Have them log in as a user that can 'only' run your test...
Paddy
what if the user not allowed to do any thing other than taking the test.? that would be more meaning ful.
vijaysylvester
+2  A: 

AFAIK, Ctrl+Alt+Del generates a hardware interrupt and cannot be handled through software applications. Probably this can be handled through system-level keyboard hooks but I am not so sure about that either.

Aamir
A: 

Have a look here:

http://www.thescarms.com/vbasic/StopReBoot.aspx

Essentially for Win9x we trick system to think that the screensaver is running (which disables Ctrl-Alt-Delete sequence) and for WinNT we remap keyboard.

DmitryK
A: 

If it proves impossible to stop the effects of ctrl-alt-delete but you can at least detect that ctrl-alt-delete has been pressed then you could always flag any occurrences and penalize the offender in an appropriate way.

RobS
Yes we can log it . may be that is the last try. If we are able to prevent , then the application looks robust. rite.?
vijaysylvester
rather if that combination is pressed by mistake ..?
vijaysylvester
Pressing ctrl-alt-delete is not going to be a mistake. It may be innocent (ie. not to cheat) but it's not going to be an accident. If students are forewarned that pressing the ctrl-alt-delete combination results in automatic failure.... ;)
RobS
+5  A: 

Based on other answers, it seems that this is possible to do. Although I highly discourage this. Take for instance that your program should for some reason hang (god forbid...). Then you would have the situation that the only thing the user can do is to turn off the computer with the power button (or pull the plug...).

It is for a good reason that this is difficult to do, and the methods are poorly documented...

The only way this looks like the way to go, is the comment from Pierre-Alain Vigeant if this is a kiosk computer or something. Then it would actually make sense to do this!

awe
But i took up an online test . it had the quoted features incorporated
vijaysylvester
See RRUZ's answer, the second link is amazing
Andomar
@Andomar - Yes, I looked at that link. And the sollution was one of two: 1. Disable the task manager in registry (not trap the keybord event) which caused a message to appear that it was disabled. 2. Write your own MyGina.dll that overrides the default functionality of Ctr + Alt + Del.Both these methods are "hacking" the system by doing permanent changes to the system. I think none of these are in the scope of just just disable the key sequence during the running of a quiz application.
awe
A: 

Set Form.TopMost to true, call Form.Activate() every millisecond and raise the process and entry thread priorities.

(Lo and behold the poor user which your application crashes on.)

Cecil Has a Name
This wouldn't help with the Control+Alt+Del problem.
Evans