diff --git a/checkin_notes b/checkin_notes index a568215c5a..607f5ffa00 100755 --- a/checkin_notes +++ b/checkin_notes @@ -14766,3 +14766,15 @@ Daniel 2004-07-06 cs_prefs.C scheduler_op.C +Rom 6 July 2004 + - Added event handler so we are notified of a system shutdown/logoff which will + allow us to shutdown gacefully instead of the OS terminating us. + - Do a little clean up work with the resource files in the hope that visual studio + won't remove the win_config.h reference the next time the resources are modified. + + client/win/ + boinc_cli.rc + boinc_dll.rc + boinc_gui.rc + boinc_ss.rc + wingui_mainwindow.cpp, .h diff --git a/client/win/boinc_cli.rc b/client/win/boinc_cli.rc index e539fee822..cd4fc7b294 100644 --- a/client/win/boinc_cli.rc +++ b/client/win/boinc_cli.rc @@ -1,7 +1,6 @@ // Microsoft Visual C++ generated resource script. // #include "boinc_cli.h" -#include "win_config.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// @@ -9,6 +8,7 @@ // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" +#include "win_config.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -31,12 +31,12 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 1 TEXTINCLUDE BEGIN "boinc_cli.h\0" - "win_config.h\0" END 2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" + "#include ""win_config.h""\r\n" "\0" END diff --git a/client/win/boinc_dll.rc b/client/win/boinc_dll.rc index d60c56a485..d3b14959e4 100644 --- a/client/win/boinc_dll.rc +++ b/client/win/boinc_dll.rc @@ -1,7 +1,6 @@ // Microsoft Visual C++ generated resource script. // #include "boinc_dll.h" -#include "win_config.h" #define APSTUDIO_READONLY_SYMBOLS ///////////////////////////////////////////////////////////////////////////// @@ -9,6 +8,7 @@ // Generated from the TEXTINCLUDE 2 resource. // #include "afxres.h" +#include "win_config.h" ///////////////////////////////////////////////////////////////////////////// #undef APSTUDIO_READONLY_SYMBOLS @@ -31,12 +31,12 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 1 TEXTINCLUDE BEGIN "boinc_dll.h\0" - "win_config.h\0" END 2 TEXTINCLUDE BEGIN "#include ""afxres.h""\r\n" + "#include ""win_config.h""\r\n" "\0" END diff --git a/client/win/wingui_mainwindow.cpp b/client/win/wingui_mainwindow.cpp index 30415387cd..35ed242928 100755 --- a/client/win/wingui_mainwindow.cpp +++ b/client/win/wingui_mainwindow.cpp @@ -210,6 +210,7 @@ BEGIN_MESSAGE_MAP(CMainWindow, CWnd) ON_COMMAND(ID_MESSAGE_COPY_TO_CLIP, OnCommandMessageCopyToClip) // Added by JBK. ON_MESSAGE(STATUS_ICON_ID, OnStatusIcon) + ON_MESSAGE(WM_QUERYENDSESSION, OnSystemLogoff) ON_REGISTERED_MESSAGE(WM_BSHOWWINDOW, OnShowWindow) ON_REGISTERED_MESSAGE(WM_BNETACTIVITY, OnNetworkActivity) @@ -2239,6 +2240,19 @@ LRESULT CMainWindow::OnTaskbarCreated(WPARAM wParam, LPARAM lParam) return TRUE; } +////////// +// CMainWindow::OnSystemLogoff +// function: +// arguments: +// returns: +LRESULT CMainWindow::OnSystemLogoff(WPARAM wParam, LPARAM lParam) +{ + // The system has notified us that the user is logging off or the + // system is shutting down, so lets go ahead and shut ourselves + // down. + return PostMessage(WM_COMMAND, ID_STATUSICON_EXIT, NULL); +} + void create_curtain() { g_myWnd->m_pSSWnd->ShowSSWindow(true); } diff --git a/client/win/wingui_mainwindow.h b/client/win/wingui_mainwindow.h index 090bdc32f8..28c54cf532 100755 --- a/client/win/wingui_mainwindow.h +++ b/client/win/wingui_mainwindow.h @@ -183,6 +183,7 @@ protected: afx_msg LRESULT OnStartScreensaver( WPARAM, LPARAM ); afx_msg LRESULT OnEndScreensaver( WPARAM, LPARAM ); afx_msg LRESULT OnTaskbarCreated( WPARAM, LPARAM ); + afx_msg LRESULT OnSystemLogoff( WPARAM, LPARAM ); CString m_MenuLabelRetryNow, m_MenuLabelGetPreferences; CString m_DialogResetQuery, m_DialogDetachQuery;