Source code of Windows XP (NT5)
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.1 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()
  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();
  52. ~CTrayUI()
  53. {
  54. DeleteCriticalSection(&m_csLock);
  55. }
  56. HRESULT HrInitTrayUI(VOID);
  57. HRESULT HrDestroyTrayUI(VOID);
  58. VOID UpdateTrayIcon(
  59. UINT uiTrayIconId,
  60. INT iIconResourceId);
  61. VOID ResetIconCount() {m_uiNextIconId = 0;};
  62. friend HRESULT HrDoMediaDisconnectedIcon(const CONFOLDENTRY& ccfe, BOOL fShowBalloon);
  63. friend LRESULT OnMyWMAddTrayIcon(HWND hwndMain, WPARAM wParam, LPARAM lParam);
  64. friend LRESULT OnMyWMRemoveTrayIcon(HWND hwndMain, WPARAM wParam, LPARAM lParam);
  65. friend LRESULT OnMyWMShowTrayIconBalloon(HWND hwndMain, WPARAM wParam, LPARAM lParam);
  66. private:
  67. HICON GetCachedHIcon(
  68. INT iIconResourceId);
  69. };
  70. extern CTrayUI * g_pCTrayUI;
  71. HRESULT HrAddTrayExtension(VOID);
  72. HRESULT HrRemoveTrayExtension(VOID);
  73. VOID FlushTrayPosts(HWND hwndTray);
  74. #endif // _CTRAYUI_H_