Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

93 lines
2.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997.
  5. //
  6. // File: C T R A Y U I . H
  7. //
  8. // Contents: Connections Tray UI class
  9. //
  10. // Notes:
  11. //
  12. // Author: jeffspr 13 Nov 1997
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #ifndef _CTRAYUI_H_
  17. #define _CTRAYUI_H_
  18. #include "connlist.h"
  19. typedef enum tagBALLOONS
  20. {
  21. BALLOON_NOTHING = 0,
  22. BALLOON_CALLBACK,
  23. BALLOON_USE_NCS
  24. } BALLOONS;
  25. class CTrayBalloon
  26. {
  27. public:
  28. ~CTrayBalloon() throw()
  29. {
  30. SysFreeString(m_szCookie);
  31. m_szCookie = NULL;
  32. }
  33. GUID m_gdGuid;
  34. CComBSTR m_szAdapterName;
  35. CComBSTR m_szMessage;
  36. BSTR m_szCookie;
  37. FNBALLOONCLICK* m_pfnFuncCallback;
  38. DWORD m_dwTimeOut; // in milliseconds
  39. };
  40. class CTrayUI
  41. {
  42. private:
  43. // Used to protect member data which is modified by different threads.
  44. //
  45. CRITICAL_SECTION m_csLock;
  46. UINT m_uiNextIconId;
  47. UINT m_uiNextHiddenIconId;
  48. typedef map<INT, HICON, less<INT> > MapIdToHicon;
  49. MapIdToHicon m_mapIdToHicon;
  50. public:
  51. CTrayUI() throw();
  52. ~CTrayUI() throw()
  53. {
  54. DeleteCriticalSection(&m_csLock);
  55. }
  56. HRESULT HrInitTrayUI(VOID);
  57. HRESULT HrDestroyTrayUI(VOID);
  58. VOID UpdateTrayIcon(
  59. IN UINT uiTrayIconId,
  60. IN INT iIconResourceId) throw();
  61. VOID ResetIconCount() throw() {m_uiNextIconId = 0;};
  62. friend HRESULT HrDoMediaDisconnectedIcon(IN const CONFOLDENTRY& ccfe, IN BOOL fShowBalloon);
  63. friend LRESULT OnMyWMAddTrayIcon(IN HWND hwndMain, IN WPARAM wParam, IN LPARAM lParam);
  64. friend LRESULT OnMyWMRemoveTrayIcon(IN HWND hwndMain, IN WPARAM wParam, IN LPARAM lParam);
  65. friend LRESULT OnMyWMShowTrayIconBalloon(IN HWND hwndMain, IN WPARAM wParam, IN LPARAM lParam);
  66. private:
  67. HICON GetCachedHIcon(
  68. IN INT iIconResourceId);
  69. };
  70. extern CTrayUI * g_pCTrayUI;
  71. HRESULT HrAddTrayExtension(VOID);
  72. HRESULT HrRemoveTrayExtension(VOID);
  73. VOID FlushTrayPosts(IN HWND hwndTray);
  74. #endif // _CTRAYUI_H_