mirror of
https://github.com/reactos/reactos.git
synced 2025-05-20 09:36:16 +00:00
Revert "[TASKMGR] Follow-up of 'Refactor trayicon.c' (99fb812
)"
This reverts commitec93c2340d
. Revert "[TASKMGR] Refactor trayicon.c" This reverts commit99fb812be4
.
This commit is contained in:
parent
36aea8e56e
commit
3fc702b588
1 changed files with 37 additions and 19 deletions
|
@ -1,16 +1,28 @@
|
||||||
/*
|
/*
|
||||||
* PROJECT: ReactOS Task Manager
|
* ReactOS Task Manager
|
||||||
* LICENSE: LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
|
*
|
||||||
* PURPOSE: Task Manager for ReactOS
|
* trayicon.c
|
||||||
* COPYRIGHT: Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
*
|
||||||
* Copyright (C) 2005 Klemens Friedl <frik85@reactos.at>
|
* Copyright (C) 1999 - 2001 Brian Palmer <brianp@reactos.org>
|
||||||
* Copyright (C) 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
|
* 2005 Klemens Friedl <frik85@reactos.at>
|
||||||
|
*
|
||||||
|
* This library is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
|
* License as published by the Free Software Foundation; either
|
||||||
|
* version 2.1 of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This library is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public
|
||||||
|
* License along with this library; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
#include <strsafe.h>
|
|
||||||
|
|
||||||
HICON TrayIcon_GetProcessorUsageIcon(void)
|
HICON TrayIcon_GetProcessorUsageIcon(void)
|
||||||
{
|
{
|
||||||
HICON hTrayIcon = NULL;
|
HICON hTrayIcon = NULL;
|
||||||
|
@ -117,13 +129,14 @@ done:
|
||||||
BOOL TrayIcon_ShellAddTrayIcon(void)
|
BOOL TrayIcon_ShellAddTrayIcon(void)
|
||||||
{
|
{
|
||||||
NOTIFYICONDATAW nid;
|
NOTIFYICONDATAW nid;
|
||||||
HICON hIcon;
|
HICON hIcon = NULL;
|
||||||
BOOL bRetVal;
|
BOOL bRetVal;
|
||||||
WCHAR szMsg[64];
|
WCHAR szMsg[64];
|
||||||
|
|
||||||
|
memset(&nid, 0, sizeof(NOTIFYICONDATAW));
|
||||||
|
|
||||||
hIcon = TrayIcon_GetProcessorUsageIcon();
|
hIcon = TrayIcon_GetProcessorUsageIcon();
|
||||||
|
|
||||||
ZeroMemory(&nid, sizeof(nid));
|
|
||||||
nid.cbSize = sizeof(NOTIFYICONDATAW);
|
nid.cbSize = sizeof(NOTIFYICONDATAW);
|
||||||
nid.hWnd = hMainWnd;
|
nid.hWnd = hMainWnd;
|
||||||
nid.uID = 0;
|
nid.uID = 0;
|
||||||
|
@ -131,8 +144,9 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
|
||||||
nid.uCallbackMessage = WM_ONTRAYICON;
|
nid.uCallbackMessage = WM_ONTRAYICON;
|
||||||
nid.hIcon = hIcon;
|
nid.hIcon = hIcon;
|
||||||
|
|
||||||
LoadStringW(NULL, IDS_MSG_TRAYICONCPUUSAGE, szMsg, _countof(szMsg));
|
|
||||||
StringCchPrintfW(nid.szTip, _countof(nid.szTip), szMsg, PerfDataGetProcessorUsage());
|
LoadStringW( GetModuleHandleW(NULL), IDS_MSG_TRAYICONCPUUSAGE, szMsg, sizeof(szMsg) / sizeof(szMsg[0]));
|
||||||
|
wsprintfW(nid.szTip, szMsg, PerfDataGetProcessorUsage());
|
||||||
|
|
||||||
bRetVal = Shell_NotifyIconW(NIM_ADD, &nid);
|
bRetVal = Shell_NotifyIconW(NIM_ADD, &nid);
|
||||||
|
|
||||||
|
@ -145,36 +159,40 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
|
||||||
BOOL TrayIcon_ShellRemoveTrayIcon(void)
|
BOOL TrayIcon_ShellRemoveTrayIcon(void)
|
||||||
{
|
{
|
||||||
NOTIFYICONDATAW nid;
|
NOTIFYICONDATAW nid;
|
||||||
|
BOOL bRetVal;
|
||||||
|
|
||||||
|
memset(&nid, 0, sizeof(NOTIFYICONDATAW));
|
||||||
|
|
||||||
ZeroMemory(&nid, sizeof(nid));
|
|
||||||
nid.cbSize = sizeof(NOTIFYICONDATAW);
|
nid.cbSize = sizeof(NOTIFYICONDATAW);
|
||||||
nid.hWnd = hMainWnd;
|
nid.hWnd = hMainWnd;
|
||||||
nid.uID = 0;
|
nid.uID = 0;
|
||||||
nid.uFlags = 0;
|
nid.uFlags = 0;
|
||||||
nid.uCallbackMessage = WM_ONTRAYICON;
|
nid.uCallbackMessage = WM_ONTRAYICON;
|
||||||
|
|
||||||
return Shell_NotifyIconW(NIM_DELETE, &nid);
|
bRetVal = Shell_NotifyIconW(NIM_DELETE, &nid);
|
||||||
|
|
||||||
|
return bRetVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL TrayIcon_ShellUpdateTrayIcon(void)
|
BOOL TrayIcon_ShellUpdateTrayIcon(void)
|
||||||
{
|
{
|
||||||
NOTIFYICONDATAW nid;
|
NOTIFYICONDATAW nid;
|
||||||
HICON hIcon;
|
HICON hIcon = NULL;
|
||||||
BOOL bRetVal;
|
BOOL bRetVal;
|
||||||
WCHAR szTemp[64];
|
WCHAR szTemp[64];
|
||||||
|
|
||||||
|
memset(&nid, 0, sizeof(NOTIFYICONDATAW));
|
||||||
|
|
||||||
hIcon = TrayIcon_GetProcessorUsageIcon();
|
hIcon = TrayIcon_GetProcessorUsageIcon();
|
||||||
|
|
||||||
ZeroMemory(&nid, sizeof(nid));
|
|
||||||
nid.cbSize = sizeof(NOTIFYICONDATAW);
|
nid.cbSize = sizeof(NOTIFYICONDATAW);
|
||||||
nid.hWnd = hMainWnd;
|
nid.hWnd = hMainWnd;
|
||||||
nid.uID = 0;
|
nid.uID = 0;
|
||||||
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
nid.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP;
|
||||||
nid.uCallbackMessage = WM_ONTRAYICON;
|
nid.uCallbackMessage = WM_ONTRAYICON;
|
||||||
nid.hIcon = hIcon;
|
nid.hIcon = hIcon;
|
||||||
|
LoadStringW(hInst, IDS_MSG_TRAYICONCPUUSAGE, szTemp, sizeof(szTemp)/sizeof(szTemp[0]));
|
||||||
LoadStringW(NULL, IDS_MSG_TRAYICONCPUUSAGE, szTemp, _countof(szTemp));
|
wsprintfW(nid.szTip, szTemp, PerfDataGetProcessorUsage());
|
||||||
StringCchPrintfW(nid.szTip, _countof(nid.szTip), szTemp, PerfDataGetProcessorUsage());
|
|
||||||
|
|
||||||
bRetVal = Shell_NotifyIconW(NIM_MODIFY, &nid);
|
bRetVal = Shell_NotifyIconW(NIM_MODIFY, &nid);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue