|
-
March 15th, 2010, 08:16 AM
#1
Stop Shutdown while working on my software
Hi.
I want to stop shutdown while my software is working. If anyone is pressing shutdown button my application have to prompt a message showing "whether u want to shutdown(Yes) or not(No)" If we press YES then only my computer have to shut down.
I did with Platform SDK help but not working. Can u give sample
case WM_QUERYENDSESSION:
{
int r;
r = MessageBox(NULL, "Shut down?","WM_QUERYENDSESSION", MB_YESNO);
// Return TRUE to allow shutdown, FALSE to stop.
return r == IDYES;
break;
}
THe above code i tried but didnt get any idea. Please help
Thanks in advance
-
March 15th, 2010, 09:26 AM
#2
Re: Stop Shutdown while working on my software
This is the correct use.
 Originally Posted by MSDN
If your application must block or postpone system shutdown, use the ShutdownBlockReasonCreate function.
Try calling ShutdownBlockReasonCreate() when you don't want to system to be shut down, and ShutdownBlockReasonDestroy() when you want to allow the system to shut down.
Also, on Vista and newer systems
 Originally Posted by MSDN
If an application returns FALSE in response to WM_QUERYENDSESSION, it still appears in the shutdown UI. Note that the system does not allow console applications or applications without a visible window to cancel shutdown. These applications are automatically terminated if they do not respond to WM_QUERYENDSESSION or WM_ENDSESSION within 5 seconds or if they return FALSE in response to WM_QUERYENDSESSION.
-
March 16th, 2010, 05:33 PM
#3
Re: Stop Shutdown while working on my software
you are saying very good information to me
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|