Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 478
  • Last Modified:

Log off cancellation notification to applications

Hello Experts,
My application runs on Windows 7 and when the user initiates a Windows Log-Off, I receive the message WM_QUERYENDSESSION through the method 'WindowProc'. At this point, I also get windows 'Force log off' screen as shown in the attached screenshot. When I click on cancel on this screen, is there any way that I can interpret this event in my program. I mean, just the way a log-off sent WM_QUERYENDSESSION, will I be notified with any message saying the log-off process was cancelled.

1 Solution
Julian HansenCommented:
Not sure if this applies but in this article http://msdn.microsoft.com/en-za/library/ms700677%28v=vs.85%29.aspx It says

If any top level window returns FALSE to WM_QUERYENDSESSION, the shutdown is cancelled, and each top level window that was sent WM_QUERYENDSESSION will be sent WM_ENDSESSION with wParam == FALSE.

The article refers to XP but check to see if you don't get the WM_ENDSESSION message with param = FALSE
sukhoi35Author Commented:
Thanks :)

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now