Hi John,
You can hook the "closing" event of the form and minimaze it (and cancel the
event)
private void Form1_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
this.WindowState = FormWindowState.Minimized;
e.Cancel=true;
}
HTH
Fran?ois J Miton
> Hi
>
[quoted text clipped - 4 lines]
>
> John
John O'Neill - 29 Jun 2004 12:01 GMT
Thanks for your suggestion Fran?ois, but thats not quite what I was hoping
for. When my application is running and I choose to shut-down my computer,
my application just gets minimised and stays running and my computer does
not shutdown (because the Closing event is cancelled). What I think I need
to know is how can I tell if the user has clicked on the [X] button so I can
handle that instead of hooking in to the Closing event?
Thanks again
John
> Hi John,
>
[quoted text clipped - 25 lines]
> >
> > John
Hi John,
Maybe you can try overriding the WndProc and handling the WM_SYSCOMMAND
message, then change the SC_CLOSE command to SC_MINIMIZE before passing it
to base.WndProc method. For more information , you may read the
documentation of the WM_SYSCOMMAND message.
Does it resolve your problem?
Please feel free to reply this thread if you still have problem on it.
Have a nice day.
Best regards,
Ying-Shen Yu [MSFT]
Microsoft Community Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
John O'Neill - 30 Jun 2004 11:52 GMT
Hi Ying-Shen
Your suggestion has solved my problem.
Thank you very much.
John
> Hi John,
> Maybe you can try overriding the WndProc and handling the WM_SYSCOMMAND
[quoted text clipped - 15 lines]
> This mail should not be replied directly, please remove the word "online"
> before sending mail.