From 48e9b84bb2215fb77d53f5bef10f965bef2043f1 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sat, 5 Dec 2015 21:39:53 +0100 Subject: [PATCH] Enhance the version detection capacity By adding targeting in notepad++.manifest: https://msdn.microsoft.com/en-us/library/windows/desktop/dn481241(v=vs.85).aspx Windows 8.1 and windows 10 are detected correctely --- .../src/MISC/PluginsManager/Notepad_plus_msgs.h | 2 +- PowerEditor/src/Parameters.cpp | 4 ++++ PowerEditor/src/notepad++.exe.manifest | 14 ++++++++++++++ PowerEditor/src/winmain.cpp | 4 ++-- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h index 18e6add0..924f8b34 100644 --- a/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h +++ b/PowerEditor/src/MISC/PluginsManager/Notepad_plus_msgs.h @@ -44,7 +44,7 @@ enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\ // The end of enumated language type, so it should be always at the end L_EXTERNAL}; -enum winVer{WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7, WV_WIN8, WV_WIN81}; +enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7, WV_WIN8, WV_WIN81, WV_WIN10}; diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index 87fd3604..f03d8978 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -722,6 +722,7 @@ generic_string ThemeSwitcher::getThemeFromXmlFileName(const TCHAR *xmlFullPath) #pragma warning(disable : 4996) + winVer getWindowsVersion() { OSVERSIONINFOEX osvi; @@ -750,6 +751,9 @@ winVer getWindowsVersion() { case VER_PLATFORM_WIN32_NT: { + if (osvi.dwMajorVersion == 10 && osvi.dwMinorVersion == 0) + return WV_WIN10; + if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 3) return WV_WIN81; diff --git a/PowerEditor/src/notepad++.exe.manifest b/PowerEditor/src/notepad++.exe.manifest index 3e09e9da..b78fd917 100644 --- a/PowerEditor/src/notepad++.exe.manifest +++ b/PowerEditor/src/notepad++.exe.manifest @@ -20,6 +20,20 @@ /> + + + + + + + + + + + + + + diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 60387308..569a34a4 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -336,7 +336,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) // tell the running instance the FULL path to the new files to load size_t nrFilesToOpen = params.size(); - for(size_t i = 0; i < nrFilesToOpen; ++i) + for (size_t i = 0; i < nrFilesToOpen; ++i) { const TCHAR * currentFile = params.at(i); if (currentFile[0]) @@ -460,7 +460,7 @@ DEVOMER*/ { // According to MSDN ChangeWindowMessageFilter may not be supported in future versions of Windows, // that is why we use ChangeWindowMessageFilterEx if it is available (windows version >= Win7). - if(pNppParameters->getWinVersion() == WV_VISTA) + if (pNppParameters->getWinVersion() == WV_VISTA) { typedef BOOL (WINAPI *MESSAGEFILTERFUNC)(UINT message,DWORD dwFlag); const DWORD MSGFLT_ADD = 1;