[STOBJECT] Revert b7c3398 because it was not the cause of the original problem I...
[reactos.git] / dll / shellext / stobject / csystray.cpp
index 8551fbc..89bd5c5 100644 (file)
@@ -4,11 +4,13 @@
 * FILE:        dll/shellext/stobject/csystray.cpp
 * PURPOSE:     Systray shell service object implementation
 * PROGRAMMERS: David Quintana <gigaherz@gmail.com>
+*              Shriraj Sawant a.k.a SR13 <sr.official@hotmail.com>
 */
 
 #include "precomp.h"
 
-WINE_DEFAULT_DEBUG_CHANNEL(stobject);
+#include <undocshell.h>
+#include <shellutils.h>
 
 SysTrayIconHandlers_t g_IconHandlers [] = {
         { Volume_Init, Volume_Shutdown, Volume_Update, Volume_Message },
@@ -97,7 +99,27 @@ HRESULT CSysTray::ProcessIconMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, LR
     return S_FALSE;
 }
 
-HRESULT CSysTray::NotifyIcon(INT code, UINT uId, HICON hIcon, LPCWSTR szTip)
+/*++
+* @name NotifyIcon
+*
+* Basically a Shell_NotifyIcon wrapper.
+* Based on the parameters provided, it changes the current state of the notification icon.
+*
+* @param code
+*        Determines whether to add, delete or modify the notification icon (represented by uId).
+* @param uId
+*        Represents the particular notification icon.
+* @param hIcon
+*        A handle to an icon for the notification object.
+* @param szTip
+*        A string for the tooltip of the notification.
+* @param dwstate
+*        Determines whether to show or hide the notification icon.
+*
+* @return The error code.
+*
+*--*/
+HRESULT CSysTray::NotifyIcon(INT code, UINT uId, HICON hIcon, LPCWSTR szTip, DWORD dwstate)
 {
     NOTIFYICONDATA nim = { 0 };
 
@@ -108,8 +130,8 @@ HRESULT CSysTray::NotifyIcon(INT code, UINT uId, HICON hIcon, LPCWSTR szTip)
     nim.hIcon = hIcon;
     nim.uID = uId;
     nim.uCallbackMessage = uId;
-    nim.dwState = 0;
-    nim.dwStateMask = 0;
+    nim.dwState = dwstate;
+    nim.dwStateMask = NIS_HIDDEN;
     nim.hWnd = m_hWnd;
     nim.uVersion = NOTIFYICON_VERSION;
     if (szTip)
@@ -219,30 +241,8 @@ BOOL CSysTray::ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM
         return TRUE;
 
     case WM_TIMER:
-        switch (wParam)
-        {
-            case 1:
-                UpdateIcons();
-                return TRUE;
-
-            case POWER_TIMER_ID:
-                Power_OnTimer(hWnd);
-                break;
-
-            case VOLUME_TIMER_ID:
-                Volume_OnTimer(hWnd);
-                break;
-
-            case HOTPLUG_TIMER_ID:
-                Hotplug_OnTimer(hWnd);
-                break;
-        }
-        break;
-
-    case WM_DEVICECHANGE:
-        ERR("WM_DEVICECHANGE\n");
-        break;
-
+        UpdateIcons();
+        return TRUE;
     case WM_DESTROY:
         KillTimer(1);
         ShutdownIcons();