Click here to Skip to main content
15,889,216 members
Home / Discussions / C#
   

C#

 
GeneralRe: Error Messages Pin
BP12829-Jan-04 18:01
BP12829-Jan-04 18:01 
GeneralRe: Error Messages Pin
Heath Stewart30-Jan-04 3:34
protectorHeath Stewart30-Jan-04 3:34 
GeneralSecurity Issues Pin
Ken Galer29-Jan-04 10:26
Ken Galer29-Jan-04 10:26 
GeneralRe: Security Issues Pin
Heath Stewart29-Jan-04 13:16
protectorHeath Stewart29-Jan-04 13:16 
GeneralRe: Security Issues Pin
Ken Galer30-Jan-04 2:23
Ken Galer30-Jan-04 2:23 
GeneralRe: Security Issues Pin
Heath Stewart30-Jan-04 3:23
protectorHeath Stewart30-Jan-04 3:23 
GeneralOver ride closing event Pin
Daniel Negron29-Jan-04 9:27
Daniel Negron29-Jan-04 9:27 
GeneralRe: Over ride closing event Pin
Heath Stewart29-Jan-04 13:08
protectorHeath Stewart29-Jan-04 13:08 
Calling Application.Exit sends the WM_QUIT message to the application, this the pump catches and the WM_CLOSE event is not (typically) called, so OnClosing is not executed. That much you've discovered. When handling the WM_QUERYENDSESSION notification message, though, you should set Message.Result = new IntPtr(1); in order to essentially return TRUE as the return value so that the shutdown process isn't canceled. By not setting this value, FALSE is essentially returned and the shutdown process is cancelled as you have noticed.

For more information, see the documentation for the WM_QUERYENDSESSION notification message at http://msdn.microsoft.com/library/en-us/sysinfo/base/wm_queryendsession.asp[^] and pay close attention the return value documentation and the remarks section. Hopefully this will help, but it won't combine those two handlers. Honestly though, it really doesn't matter - it solves the problem and that's what counts. Besides, the Closing event is triggered by the WM_CLOSE message which isn't sent to Windows unless the application pump handles an appropriate message and sends or posts the message itself (at least, from what I remember).

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralListbox deleting items Pin
Gavin Coates29-Jan-04 8:19
Gavin Coates29-Jan-04 8:19 
GeneralRe: Listbox deleting items Pin
Mazdak29-Jan-04 8:28
Mazdak29-Jan-04 8:28 
GeneralRe: Listbox deleting items Pin
Gavin Coates29-Jan-04 9:09
Gavin Coates29-Jan-04 9:09 
GeneralRe: Listbox deleting items Pin
Mazdak29-Jan-04 9:14
Mazdak29-Jan-04 9:14 
GeneralRe: Listbox deleting items Pin
Gavin Coates29-Jan-04 9:52
Gavin Coates29-Jan-04 9:52 
GeneralRe: Listbox deleting items Pin
thomasa30-Jan-04 0:45
thomasa30-Jan-04 0:45 
GeneralRe: Listbox deleting items Pin
Gavin Coates31-Jan-04 10:17
Gavin Coates31-Jan-04 10:17 
GeneralRe: Listbox deleting items Pin
thomasa1-Feb-04 22:14
thomasa1-Feb-04 22:14 
GeneralMulti-threading Pin
Guinness4Strength29-Jan-04 5:17
Guinness4Strength29-Jan-04 5:17 
GeneralRe: Multi-threading Pin
scadaguy29-Jan-04 10:23
scadaguy29-Jan-04 10:23 
GeneralRe: Multi-threading Pin
Guinness4Strength29-Jan-04 10:27
Guinness4Strength29-Jan-04 10:27 
GeneralRe: Multi-threading Pin
Heath Stewart29-Jan-04 12:55
protectorHeath Stewart29-Jan-04 12:55 
GeneralDatabase Problem, PLEASE HELP Pin
gls2ro29-Jan-04 4:24
gls2ro29-Jan-04 4:24 
Generalconvert web form to windows form Pin
OmegaSupreme29-Jan-04 4:19
OmegaSupreme29-Jan-04 4:19 
GeneralRe: convert web form to windows form Pin
Colin Angus Mackay29-Jan-04 14:40
Colin Angus Mackay29-Jan-04 14:40 
GeneralRe: convert web form to windows form Pin
OmegaSupreme29-Jan-04 23:43
OmegaSupreme29-Jan-04 23:43 
GeneralRe: convert web form to windows form Pin
Kentamanos29-Jan-04 19:22
Kentamanos29-Jan-04 19:22 

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.