Click here to Skip to main content
15,890,123 members
Home / Discussions / C#
   

C#

 
GeneralRe: Question on lifetime of context existance Pin
Michael J. Eber21-Feb-10 18:09
Michael J. Eber21-Feb-10 18:09 
GeneralRe: Question on lifetime of context existance Pin
Michael Eber23-Feb-10 10:19
Michael Eber23-Feb-10 10:19 
QuestionRetrieve database by using web service Pin
dalila y21-Feb-10 3:48
dalila y21-Feb-10 3:48 
AnswerRe: Retrieve database by using web service Pin
Not Active21-Feb-10 4:23
mentorNot Active21-Feb-10 4:23 
AnswerRe: Retrieve database by using web service Pin
Eddy Vluggen21-Feb-10 4:58
professionalEddy Vluggen21-Feb-10 4:58 
QuestionLooking for Generics Labs Pin
jakehn21-Feb-10 3:03
jakehn21-Feb-10 3:03 
AnswerRe: Looking for Generics Labs Pin
Not Active21-Feb-10 3:15
mentorNot Active21-Feb-10 3:15 
QuestionClosing application when windows shuts down Pin
davearias21-Feb-10 1:25
davearias21-Feb-10 1:25 
Hi,

I have wriiten a little application that runs mainly in the background. There is a U.I. trhat can be accessed by double clicking its icon in the notification bar. The problem is when I try to restart or shut down my XP machine the application will not close. This appears to be not an issue on Windows 7 as it shutsdown fine, I suspect Vista could be ok also.

I checked the event viewer the event was to the effect The attempt to reboot PC failed. I have read a little and I added the following to my code

// 1. Global variable in main form<br />
private int WM_QUERYENDSESSION = 0x11;<br />
<br />
//2. Override WndProc<br />
 protected override void WndProc(ref Message m)<br />
{<br />
    if (m.Msg == WM_QUERYENDSESSION)<br />
    {<br />
       Application.ExitThread();               <br />
    }           <br />
    base.WndProc(ref m);                     <br />
 }


This works in as much as the application closes when I try to restart my machine, but the machine does not restart I have to tell to restart once more before it restarts. I feel it's almost there but I am not sure what is missing.

Help if you can, Dave.
AnswerRe: Closing application when windows shuts down Pin
davearias21-Feb-10 1:43
davearias21-Feb-10 1:43 
GeneralRe: Closing application when windows shuts down Pin
Geoff Williams21-Feb-10 2:40
Geoff Williams21-Feb-10 2:40 
GeneralRe: Closing application when windows shuts down Pin
davearias21-Feb-10 10:33
davearias21-Feb-10 10:33 
AnswerRe: Closing application when windows shuts down Pin
Luc Pattyn21-Feb-10 2:44
sitebuilderLuc Pattyn21-Feb-10 2:44 
GeneralRe: Closing application when windows shuts down Pin
davearias21-Feb-10 10:36
davearias21-Feb-10 10:36 
AnswerRe: Closing application when windows shuts down Pin
Luc Pattyn21-Feb-10 10:44
sitebuilderLuc Pattyn21-Feb-10 10:44 
QuestionMagic Numbers File Type checking Pin
Joezer BH20-Feb-10 22:09
professionalJoezer BH20-Feb-10 22:09 
QuestionReturn Dataset to Business Layer & SHOW in datagrid in Presentation Layer Pin
shahramkeyboard20-Feb-10 20:58
shahramkeyboard20-Feb-10 20:58 
AnswerRe: Return Dataset to Business Layer & SHOW in datagrid in Presentation Layer Pin
Dan Mos20-Feb-10 21:02
Dan Mos20-Feb-10 21:02 
AnswerRe: Return Dataset to Business Layer & SHOW in datagrid in Presentation Layer Pin
shahramkeyboard20-Feb-10 21:07
shahramkeyboard20-Feb-10 21:07 
GeneralRe: Return Dataset to Business Layer & SHOW in datagrid in Presentation Layer Pin
Dan Mos20-Feb-10 21:23
Dan Mos20-Feb-10 21:23 
GeneralRe: Return Dataset to Business Layer & SHOW in datagrid in Presentation Layer Pin
shahramkeyboard20-Feb-10 21:55
shahramkeyboard20-Feb-10 21:55 
GeneralDoes this help? Pin
Dan Mos20-Feb-10 22:25
Dan Mos20-Feb-10 22:25 
GeneralRe: Does this help? Pin
shahramkeyboard21-Feb-10 1:46
shahramkeyboard21-Feb-10 1:46 
GeneralRe: Does this help? [modified] Pin
Dan Mos21-Feb-10 16:27
Dan Mos21-Feb-10 16:27 
AnswerRe: Return Dataset to Business Layer & SHOW in datagrid in Presentation Layer Pin
dan!sh 20-Feb-10 23:33
professional dan!sh 20-Feb-10 23:33 
GeneralRe: Return Dataset to Business Layer & SHOW in datagrid in Presentation Layer [modified] Pin
shahramkeyboard21-Feb-10 2:30
shahramkeyboard21-Feb-10 2:30 

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.