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 */ 9 #pragma once 10 11 extern const GUID CLSID_SysTray; 12 13 14 typedef CWinTraits < 15 WS_POPUP | WS_DLGFRAME | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, 16 WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR | WS_EX_PALETTEWINDOW 17 > CMessageWndClass; 18 19 class CSysTray : 20 public CComCoClass<CSysTray, &CLSID_SysTray>, 21 public CComObjectRootEx<CComMultiThreadModelNoCS>, 22 public CWindowImpl<CSysTray, CWindow, CMessageWndClass>, 23 public IOleCommandTarget 24 { 25 CComPtr<IOleCommandTarget> pctNetShell; 26 27 // TODO: keep icon handlers here 28 29 HWND hwndSysTray; 30 31 static DWORD WINAPI s_SysTrayThreadProc(PVOID param); 32 HRESULT SysTrayMessageLoop(); 33 HRESULT SysTrayThreadProc(); 34 HRESULT CreateSysTrayThread(); 35 HRESULT DestroySysTrayWindow(); 36 37 HRESULT InitIcons(); 38 HRESULT ShutdownIcons(); 39 HRESULT UpdateIcons(); 40 HRESULT ProcessIconMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult); 41 42 HRESULT InitNetShell(); 43 HRESULT ShutdownNetShell(); 44 45 public: 46 HRESULT NotifyIcon(INT code, UINT uId, HICON hIcon, LPCWSTR szTip); 47 48 HWND GetHWnd() { return m_hWnd; } 49 50 protected: 51 BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID = 0); 52 53 public: 54 CSysTray(); 55 virtual ~CSysTray(); 56 57 // *** IOleCommandTarget methods *** 58 virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText); 59 virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); 60 61 DECLARE_WND_CLASS_EX(_T("SystemTray_Main"), CS_GLOBALCLASS, COLOR_3DFACE) 62 63 DECLARE_REGISTRY_RESOURCEID(IDR_SYSTRAY) 64 DECLARE_NOT_AGGREGATABLE(CSysTray) 65 DECLARE_PROTECT_FINAL_CONSTRUCT() 66 67 BEGIN_COM_MAP(CSysTray) 68 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) 69 END_COM_MAP() 70 71 };