Make tray icon work again in administrator mode

Fix #8528, close #8944
pull/8953/head
Udo Hoffmann 2020-10-03 13:49:16 +02:00 committed by Don HO
parent 5e632dfbef
commit 5aab1ddbf1
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
4 changed files with 6 additions and 7 deletions

View File

@ -389,7 +389,7 @@ LRESULT Notepad_plus::init(HWND hwnd)
if (nppGUI._isMinimizedToTray && _pTrayIco == NULL)
{
HICON icon = ::LoadIcon(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDI_M30ICON));
_pTrayIco = new trayIconControler(hwnd, IDI_M30ICON, IDC_MINIMIZED_TRAY, icon, TEXT(""));
_pTrayIco = new trayIconControler(hwnd, IDI_M30ICON, NPPM_INTERNAL_MINIMIZED_TRAY, icon, TEXT(""));
}
checkSyncState();

View File

@ -185,7 +185,7 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
}
else
{
_notepad_plus_plus_core._pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), TEXT(""));
_notepad_plus_plus_core._pTrayIco = new trayIconControler(_hSelf, IDI_M30ICON, NPPM_INTERNAL_MINIMIZED_TRAY, ::LoadIcon(_hInst, MAKEINTRESOURCE(IDI_M30ICON)), TEXT(""));
_notepad_plus_plus_core._pTrayIco->doTrayIcon(ADD);
}
std::vector<generic_string> fileNames;

View File

@ -1909,10 +1909,10 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case WM_SYSCOMMAND:
{
const NppGUI & nppgui = (nppParam.getNppGUI());
if (((nppgui._isMinimizedToTray && !_isAdministrator) || _pPublicInterface->isPrelaunch()) && (wParam == SC_MINIMIZE))
if ((nppgui._isMinimizedToTray || _pPublicInterface->isPrelaunch()) && (wParam == SC_MINIMIZE))
{
if (nullptr == _pTrayIco)
_pTrayIco = new trayIconControler(hwnd, IDI_M30ICON, IDC_MINIMIZED_TRAY, ::LoadIcon(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDI_M30ICON)), TEXT(""));
_pTrayIco = new trayIconControler(hwnd, IDI_M30ICON, NPPM_INTERNAL_MINIMIZED_TRAY, ::LoadIcon(_pPublicInterface->getHinst(), MAKEINTRESOURCE(IDI_M30ICON)), TEXT(""));
_pTrayIco->doTrayIcon(ADD);
::ShowWindow(hwnd, SW_HIDE);
@ -1937,7 +1937,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return TRUE;
}
case IDC_MINIMIZED_TRAY:
case NPPM_INTERNAL_MINIMIZED_TRAY:
{
switch (lParam)
{

View File

@ -280,8 +280,6 @@
#define IDD_FILEVIEW_DIALOG 1000
#define IDC_MINIMIZED_TRAY 67001
#define IDD_CREATE_DIRECTORY 1100
#define IDC_STATIC_CURRENT_FOLDER 1101
#define IDC_EDIT_NEW_FOLDER 1102
@ -448,6 +446,7 @@
#define NPPM_INTERNAL_EDGEMULTISETSIZE (NOTEPADPLUS_USER_INTERNAL + 51)
#define NPPM_INTERNAL_UPDATECLICKABLELINKS (NOTEPADPLUS_USER_INTERNAL + 52)
#define NPPM_INTERNAL_SCINTILLAFINDERWRAP (NOTEPADPLUS_USER_INTERNAL + 53)
#define NPPM_INTERNAL_MINIMIZED_TRAY (NOTEPADPLUS_USER_INTERNAL + 54)
// See Notepad_plus_msgs.h
//#define NOTEPADPLUS_USER (WM_USER + 1000)