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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dev

    #1

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

    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





  • Tyler Dixon

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

    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_Closin g(object sender, CancelEventArgs e)
    {
    e.Cancel = myKeyStrokeWasP ressed;
    }

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

    "Dev" <rajan_sr99@hot mail.com> wrote in message
    news:e52h3ciRDH A.1804@TK2MSFTN GP11.phx.gbl...[color=blue]
    > 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
    >
    >
    >
    >
    >[/color]


    Comment

    Working...