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.

69 lines
2.7 KiB

  1. #pragma once
  2. #include "stdafx.h"
  3. #include <windows.h>
  4. #include "resource.h"
  5. #include "beacon.h"
  6. #include "winsock2.h"
  7. #define WM_APP_TRAYMESSAGE WM_APP
  8. #define WM_APP_ADDBEACON WM_APP+1 // wParam: unused, lParam: IInternetGateway*
  9. #define WM_APP_REMOVEBEACON WM_APP+2 // wParam: unused, lParam: unused
  10. #define WM_APP_SOCKET_NOTIFICATION WM_APP+3
  11. #define WM_APP_GETBEACON WM_APP+4
  12. class CICSTrayIcon : public CWindowImpl<CICSTrayIcon>
  13. {
  14. public:
  15. BEGIN_MSG_MAP(CICSTrayIcon)
  16. MESSAGE_HANDLER(WM_CREATE, OnCreate)
  17. MESSAGE_HANDLER(WM_CLOSE, OnClose)
  18. MESSAGE_HANDLER(WM_DESTROY, OnDestroy)
  19. MESSAGE_HANDLER(WM_APP_TRAYMESSAGE, OnTrayMessage)
  20. MESSAGE_HANDLER(WM_APP_ADDBEACON, OnAddBeacon)
  21. MESSAGE_HANDLER(WM_APP_REMOVEBEACON, OnRemoveBeacon)
  22. MESSAGE_HANDLER(WM_APP_SOCKET_NOTIFICATION, OnSocketNotification)
  23. MESSAGE_HANDLER(WM_APP_GETBEACON, OnGetBeacon)
  24. COMMAND_ID_HANDLER(IDM_TRAYICON_STATUS, OnStatus)
  25. COMMAND_ID_HANDLER(IDM_TRAYICON_PROPERTIES, OnProperties)
  26. COMMAND_ID_HANDLER(IDM_TRAYICON_CONNECT, OnConnect)
  27. COMMAND_ID_HANDLER(IDM_TRAYICON_DISCONNECT, OnDisconnect)
  28. END_MSG_MAP()
  29. CICSTrayIcon();
  30. ~CICSTrayIcon();
  31. private:
  32. HRESULT GetInternetGateway(IInternetGateway** ppInternetGateway);
  33. HRESULT ShowTrayIcon(UINT uID);
  34. HRESULT HideTrayIcon(UINT uID);
  35. HRESULT StartSearch(void);
  36. LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  37. LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  38. LRESULT OnEndSession(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  39. LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  40. LRESULT OnTrayMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  41. LRESULT OnAddBeacon(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  42. LRESULT OnRemoveBeacon(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  43. LRESULT OnSocketNotification(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  44. LRESULT OnGetBeacon(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  45. LRESULT OnStatus(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  46. LRESULT OnProperties(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  47. LRESULT OnConnect(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  48. LRESULT OnDisconnect(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  49. IInternetGateway* m_pInternetGateway;
  50. HRESULT m_hShowIconResult;
  51. IUPnPDeviceFinder* m_pDeviceFinder;
  52. LONG m_lSearchCookie;
  53. SOCKET m_DummySocket;
  54. BOOL m_bShowingProperties;
  55. BOOL m_bShowingStatus;
  56. DWORD m_dwRegisterClassCookie;
  57. BOOL m_bFileVersionsAccepted;
  58. };