1 2 /// CLSID 3 /// HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{7007ACCF-3202-11D1-AAD2-00805FC1270E} 4 // IID B722BCCB-4E68-101B-A2BC-00AA00404770 5 6 #define WM_SHOWSTATUSDLG (WM_USER+10) 7 8 typedef struct tagNotificationItem 9 { 10 struct tagNotificationItem *pNext; 11 CLSID guidItem; 12 UINT uID; 13 HWND hwndDlg; 14 INetConnection *pNet; 15 } NOTIFICATION_ITEM; 16 17 typedef struct 18 { 19 INetConnection *pNet; 20 HWND hwndStatusDlg; /* LanStatusDlg window */ 21 HWND hwndDlg; /* status dialog window */ 22 DWORD dwAdapterIndex; 23 UINT_PTR nIDEvent; 24 UINT DHCPEnabled; 25 DWORD dwInOctets; 26 DWORD dwOutOctets; 27 DWORD IpAddress; 28 DWORD SubnetMask; 29 DWORD Gateway; 30 UINT uID; 31 UINT Status; 32 } LANSTATUSUI_CONTEXT; 33 34 class CLanStatus: 35 public CComCoClass<CLanStatus, &CLSID_ConnectionTray>, 36 public CComObjectRootEx<CComMultiThreadModelNoCS>, 37 public IOleCommandTarget 38 { 39 public: 40 CLanStatus(); 41 42 // IOleCommandTarget 43 virtual HRESULT WINAPI QueryStatus(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD *prgCmds, OLECMDTEXT *pCmdText); 44 virtual HRESULT WINAPI Exec(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut); 45 46 private: 47 HRESULT InitializeNetTaskbarNotifications(); 48 HRESULT ShowStatusDialogByCLSID(const GUID *pguidCmdGroup); 49 50 CComPtr<INetConnectionManager> m_lpNetMan; 51 NOTIFICATION_ITEM *m_pHead; 52 53 public: 54 DECLARE_NO_REGISTRY() 55 DECLARE_CENTRAL_INSTANCE_NOT_AGGREGATABLE(CLanStatus) 56 DECLARE_PROTECT_FINAL_CONSTRUCT() 57 58 BEGIN_COM_MAP(CLanStatus) 59 COM_INTERFACE_ENTRY_IID(IID_IOleCommandTarget, IOleCommandTarget) 60 END_COM_MAP() 61 62 }; 63