1 /* 2 * PROJECT: ReactOS system libraries 3 * LICENSE: GPL - See COPYING in the top level directory 4 * FILE: dll/shellext/stobject/csystray.h 5 * PURPOSE: Systray shell service object 6 * PROGRAMMERS: Robert Naumann 7 * David Quintana <gigaherz@gmail.com> 8 * Shriraj Sawant a.k.a SR13 <sr.official@hotmail.com> 9 */ 10 11 #pragma once 12 13 extern const GUID CLSID_SysTray; 14 15 16 typedef CWinTraits < 17 WS_POPUP | WS_DLGFRAME | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 18 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_PALETTEWINDOW 19 > CMessageWndClass; 20 21 class CSysTray : 22 public CComCoClass<CSysTray, &CLSID_SysTray>, 23 public CComObjectRootEx<CComMultiThreadModelNoCS>, 24 public CWindowImpl<CSysTray, CWindow, CMessageWndClass>, 25 public IOleCommandTarget 26 { 27 CComPtr<IOleCommandTarget> pctNetShell; 28 29 // TODO: keep icon handlers here 30 31 DWORD dwServicesEnabled; 32 UINT wm_SHELLHOOK; 33 UINT wm_DESTROYWINDOW; 34 35 static DWORD WINAPI s_SysTrayThreadProc(PVOID param); 36 HRESULT SysTrayMessageLoop(); 37 HRESULT SysTrayThreadProc(); 38 HRESULT CreateSysTrayThread(); 39 HRESULT DestroySysTrayWindow(); 40 41 HRESULT InitIcons(); 42 HRESULT ShutdownIcons(); 43 HRESULT UpdateIcons(); 44 HRESULT ProcessIconMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult); 45 46 HRESULT InitNetShell(); 47 HRESULT ShutdownNetShell(); 48 49 VOID GetServicesEnabled(); 50 51 public: 52 HRESULT NotifyIcon(INT code, UINT uId, HICON hIcon, LPCWSTR szTip, DWORD dwstate = 0); 53 54 HWND GetHWnd() { return m_hWnd; } 55 56 VOID EnableService(DWORD dwServiceFlag, BOOL bEnable); 57 BOOL IsServiceEnabled(DWORD dwServiceFlag); 58 59 protected: 60 BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID = 0); 61 62 public: 63 CSysTray(); 64 virtual ~CSysTray(); 65 66 // *** IOleCommandTarget methods *** 67 virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText); 68 virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); 69 70 DECLARE_WND_CLASS_EX(_T("SystemTray_Main"), CS_GLOBALCLASS, COLOR_3DFACE) 71 72 DECLARE_REGISTRY_RESOURCEID(IDR_SYSTRAY) 73 DECLARE_NOT_AGGREGATABLE(CSysTray) 74 DECLARE_PROTECT_FINAL_CONSTRUCT() 75 76 BEGIN_COM_MAP(CSysTray) 77 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) 78 END_COM_MAP() 79 80 }; 81