#include <QtGui/QApplication>
#include "mainwindow.h"
#include "MyApplication.h"
int main(int argc, char *argv[])
{
MyApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
#ifndef MYAPPLICATION_H #define MYAPPLICATION_H
#include <QApplication> #include <QMessageBox> #include <QDebug>
#include <qt_windows.h>
class MyApplication : public QApplication { public: MyApplication( int argc, char ** argv ) : QApplication( argc, argv ) { } bool winEventFilter(MSG * msg, long * retVal) {
// qDebug() << *msg; if (msg->message == WM_QUERYENDSESSION ) { QMessageBox::information( NULL, "Session End", "Session End", "OK" ); *retVal = false; return true; } return false; }
};
#endif // MYAPPLICATION_H
|