diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml
index 184270cf2..04d503a45 100644
--- a/PowerEditor/installer/nativeLang/english.xml
+++ b/PowerEditor/installer/nativeLang/english.xml
@@ -1377,6 +1377,7 @@ Notepad++ will be restarted after all the operations are terminated.
Continue?"/>
+
diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp
index f3bbca34b..3371ff533 100644
--- a/PowerEditor/src/NppBigSwitch.cpp
+++ b/PowerEditor/src/NppBigSwitch.cpp
@@ -2106,6 +2106,18 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return TRUE;
}
+ case NPPM_INTERNAL_WINDOWSSESSIONEXIT:
+ {
+ int answer = _nativeLangSpeaker.messageBox("WindowsSessionExit",
+ _pPublicInterface->getHSelf(),
+ TEXT("Windows session is about to be terminated but you have some data unsaved. Do you want to exit Notepad++ now?"),
+ TEXT("Notepad++ - Windows session exit"),
+ MB_YESNO | MB_ICONQUESTION | MB_APPLMODAL);
+ if (answer == IDYES)
+ ::PostMessage(_pPublicInterface->getHSelf(), WM_CLOSE, 0, 0);
+ return TRUE;
+ }
+
case WM_QUERYENDSESSION:
{
// app should return TRUE or FALSE immediately upon receiving this message,
@@ -2176,7 +2188,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
::SendMessage(hwnd, WM_SIZE, 0, 0); // to make window fit (specially to show tool bar.)
}
}
- ::PostMessage(hwnd, WM_COMMAND, IDM_FILE_SAVEALL, 0); // posting will not block us here
+ ::PostMessage(hwnd, NPPM_INTERNAL_WINDOWSSESSIONEXIT, 0, 0); // posting will not block us here
return FALSE; // request abort of the shutdown
}
}
diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h
index a4d7732f9..89f1560a7 100644
--- a/PowerEditor/src/resource.h
+++ b/PowerEditor/src/resource.h
@@ -643,6 +643,7 @@
#define NPPM_INTERNAL_ENABLECHANGEHISTORY (NOTEPADPLUS_USER_INTERNAL + 67)
#define NPPM_INTERNAL_CLEANSMARTHILITING (NOTEPADPLUS_USER_INTERNAL + 68)
#define NPPM_INTERNAL_CLEANBRACEMATCH (NOTEPADPLUS_USER_INTERNAL + 69)
+ #define NPPM_INTERNAL_WINDOWSSESSIONEXIT (NOTEPADPLUS_USER_INTERNAL + 70)
// See Notepad_plus_msgs.h
//#define NOTEPADPLUS_USER (WM_USER + 1000)