Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

intercept SHUTDOWN (given from WIN_NT task bar) msg in ur APPLN

Posted on 1998-01-02
1
Medium Priority
?
695 Views
Last Modified: 2013-12-03
How to intercept (in my running application) a SHUTDOWN msg issued from NT -TASKBAR?

I am not getting any WM_ENDSESSION or WM_QUERYENDSESSION or similar msgs in my MainWindow.

But if u see DevStudio, if u have any unsaved files, DevStudio warns u about it and asks u to save unsaved work.

How they are acheiving this???

Regards,
Venkatesan Pillai
Senior Software Enginner
AUTODESK Inc,
SanFransisco, CA -94903
Ph : 415-507-4878
E-Mail : dvenkat@cyberspace.org
0
Comment
Question by:dvenkat
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 32

Accepted Solution

by:
jhance earned 60 total points
ID: 1409813
If you are using MFC you need to do the following:

In you message map add the ON_WM_QUERYENDSESSION():

BEGIN_MESSAGE_MAP(CLogStatsDlg, CDialog)
      //{{AFX_MSG_MAP(CLogStatsDlg)
      ON_WM_PAINT()
      ON_WM_QUERYDRAGICON()
      ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
      ON_WM_QUERYENDSESSION()
      //}}AFX_MSG_MAP
END_MESSAGE_MAP()

Then add the OnQueryEndSession() member function:

BOOL CLogStatsDlg::OnQueryEndSession()
{
      //if (!CDialog::OnQueryEndSession())
      //      return FALSE;
      
      // TODO: Add your specialized query end session code here
      AfxMessageBox("QUERYENDSESSION", MB_OK);
      return FALSE;  // Always refuse to shutdown!
}
0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to programmatically preset the "Pages per Sheet" option that's available with most printer drivers.   This setting lets you do "n-Up" printing, where two, four, or more pages are printed on each sheet of paper. If your …
This article surveys and compares options for encoding and decoding base64 data.  It includes source code in C++ as well as examples of how to use standard Windows API functions for these tasks. We'll look at the algorithms — how encoding and decodi…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…

610 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