Log off cancellation notification to applications

Posted on 2012-09-12
Last Modified: 2012-09-18
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.

Question by:sukhoi35
    LVL 49

    Accepted Solution

    Not sure if this applies but in this article 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

    Author Closing Comment

    Thanks :)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode ( They will have you believe that Unicode requires you to use…
    This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
    The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.
    The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now