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 HWND hwndSysTray; 32 33 static DWORD WINAPI s_SysTrayThreadProc(PVOID param); 34 HRESULT SysTrayMessageLoop(); 35 HRESULT SysTrayThreadProc(); 36 HRESULT CreateSysTrayThread(); 37 HRESULT DestroySysTrayWindow(); 38 39 HRESULT InitIcons(); 40 HRESULT ShutdownIcons(); 41 HRESULT UpdateIcons(); 42 HRESULT ProcessIconMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult); 43 44 HRESULT InitNetShell(); 45 HRESULT ShutdownNetShell(); 46 47 public: 48 HRESULT NotifyIcon(INT code, UINT uId, HICON hIcon, LPCWSTR szTip, DWORD dwstate = 0); 49 50 HWND GetHWnd() { return m_hWnd; } 51 52 protected: 53 BOOL ProcessWindowMessage(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam, LRESULT &lResult, DWORD dwMsgMapID = 0); 54 55 public: 56 CSysTray(); 57 virtual ~CSysTray(); 58 59 // *** IOleCommandTarget methods *** 60 virtual HRESULT STDMETHODCALLTYPE QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds [], OLECMDTEXT *pCmdText); 61 virtual HRESULT STDMETHODCALLTYPE Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); 62 63 DECLARE_WND_CLASS_EX(_T("SystemTray_Main"), CS_GLOBALCLASS, COLOR_3DFACE) 64 65 DECLARE_REGISTRY_RESOURCEID(IDR_SYSTRAY) 66 DECLARE_NOT_AGGREGATABLE(CSysTray) 67 DECLARE_PROTECT_FINAL_CONSTRUCT() 68 69 BEGIN_COM_MAP(CSysTray) 70 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) 71 END_COM_MAP() 72 73 };