Click here to Skip to main content
15,923,689 members
Home / Discussions / C#
   

C#

 
GeneralRe: Web Image in Windows App. Pin
Heath Stewart24-May-04 5:28
protectorHeath Stewart24-May-04 5:28 
Generalsetup by InstallShield Pin
quocbao23-May-04 16:52
quocbao23-May-04 16:52 
GeneralRe: setup by InstallShield Pin
Heath Stewart24-May-04 3:57
protectorHeath Stewart24-May-04 3:57 
GeneralComputer Shutdown problem Pin
BigBlob20223-May-04 16:25
BigBlob20223-May-04 16:25 
GeneralRe: Computer Shutdown problem Pin
sreejith ss nair23-May-04 18:20
sreejith ss nair23-May-04 18:20 
GeneralRe: Computer Shutdown problem Pin
Heath Stewart24-May-04 3:48
protectorHeath Stewart24-May-04 3:48 
GeneralRe: Computer Shutdown problem Pin
Dave Kreskowiak24-May-04 3:54
mveDave Kreskowiak24-May-04 3:54 
GeneralRe: Computer Shutdown problem Pin
Heath Stewart24-May-04 3:56
protectorHeath Stewart24-May-04 3:56 
Override WndProc in your main application Form (the Form you pass to Application.Run and handle the WM_ENDSESSION (0x0016) message, something like:
protected override void WndProc(ref Message m)
{
  base.WndProc(ref m);
  if (m.Msg == 0x0016) Application.Exit();
}
You could also implement IMessageFilter and add a reference to your implementation using Application.AddMessageFilter.

Changes are that you've overridden OnClosing or handled the Closing event of your Form in order to "minimize" your application to the systray, right? If you set the CancelEventArgs.Cancel property to true and hide your Form, this is probably why it's not shutting down - you're preventing the WM_CLOSE method to be sent to the main application Form. Handling the Windows message WM_ENDSESSION should fix this.

 

Microsoft MVP, Visual C#
My Articles
GeneralStill.. problem with a checked list box Pin
M3L23-May-04 15:20
M3L23-May-04 15:20 
GeneralRe: Still.. problem with a checked list box Pin
Heath Stewart24-May-04 3:39
protectorHeath Stewart24-May-04 3:39 
GeneralRe: Still.. problem with a checked list box Pin
M3L26-May-04 15:29
M3L26-May-04 15:29 
GeneralIs Windows server needed Pin
vjeko23-May-04 11:38
vjeko23-May-04 11:38 
GeneralRe: Is Windows server needed Pin
Colin Angus Mackay23-May-04 12:30
Colin Angus Mackay23-May-04 12:30 
GeneralRe: Is Windows server needed Pin
Vince Pacella23-May-04 12:52
sussVince Pacella23-May-04 12:52 
GeneralRe: Is Windows server needed Pin
Colin Angus Mackay23-May-04 13:03
Colin Angus Mackay23-May-04 13:03 
GeneralRe: Is Windows server needed Pin
Vince Pacella23-May-04 13:08
sussVince Pacella23-May-04 13:08 
GeneralRe: Is Windows server needed Pin
Colin Angus Mackay23-May-04 13:11
Colin Angus Mackay23-May-04 13:11 
GeneralRe: Is Windows server needed Pin
Vince Pacella23-May-04 13:13
sussVince Pacella23-May-04 13:13 
GeneralRe: Is Windows server needed Pin
Daniel Turini23-May-04 23:13
Daniel Turini23-May-04 23:13 
GeneralRe: Is Windows server needed Pin
Heath Stewart24-May-04 3:35
protectorHeath Stewart24-May-04 3:35 
GeneralRe: Is Windows server needed Pin
Dave Kreskowiak23-May-04 16:30
mveDave Kreskowiak23-May-04 16:30 
GeneralRe: Is Windows server needed Pin
vjeko24-May-04 6:15
vjeko24-May-04 6:15 
GeneralRe: Is Windows server needed Pin
Serge Lobko-Lobanovsky26-May-04 3:52
Serge Lobko-Lobanovsky26-May-04 3:52 
GeneralAlpha & Imagelists Pin
BaShOr23-May-04 0:31
BaShOr23-May-04 0:31 
GeneralRe: Alpha & Imagelists Pin
Colin Angus Mackay23-May-04 1:25
Colin Angus Mackay23-May-04 1:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.