C#(Quit the application) - shift+Ctrl+Q

D

Dev

Dear Friends,

I have created Application using VC#.

How do to the following tasks?

The user should not be allowed to exit the program: the start menu, end
task and all other ways of exiting the program should be
disabled. The Shift+Ctrl+Q (or other keystroke combination) should be the
only way to exit the program.

I disabled the close button.
If anyone knows ....Please help me....
Any suggestions would be greatly appreciated....

Thanks,
Rajan
 
T

Tyler Dixon

I don't know how you would disable "end task" from closing your program, but
I have no idea why you'd want to do that....When all else fails, you need a
way to close the program *somehow.*

Anyways, just add a handler for the Windows_Closing event in your main form
that sets the "Cancel" property to true

private void MainForm_Closing(object sender, CancelEventArgs e)
{
e.Cancel = myKeyStrokeWasPressed;
}

where myKeyStrokeWasPressed is a bool you'd set to false if, say,
Shift-Ctrl-Q was pressed. Otherwise, it's true.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top