ChannelMenu.h
上传用户:liguizhu
上传日期:2015-11-01
资源大小:2422k
文件大小:3k
源码类别:

P2P编程

开发平台:

Visual C++

  1. /*
  2.  *  Openmysee
  3.  *
  4.  *  This program is free software; you can redistribute it and/or modify
  5.  *  it under the terms of the GNU General Public License as published by
  6.  *  the Free Software Foundation; either version 2 of the License, or
  7.  *  (at your option) any later version.
  8.  *
  9.  *  This program is distributed in the hope that it will be useful,
  10.  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.  *  GNU General Public License for more details.
  13.  *
  14.  *  You should have received a copy of the GNU General Public License
  15.  *  along with this program; if not, write to the Free Software
  16.  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  17.  *
  18.  */
  19. #ifndef _CCHANNELMENU_H
  20. #define _CCHANNELMENU_H
  21. #pragma once
  22. #include <vector>
  23. #include "TrayIconMenu.h"
  24. class HttpRequest;
  25. class CXML;
  26. class CChannelMenu
  27. {
  28. protected:
  29. CChannelMenu(void);
  30. ~CChannelMenu(void);
  31. public:
  32. static CChannelMenu* CreateInstance(BOOL useChannel);
  33. static  CChannelMenu* GetInstance();
  34. static void ReleaseInstance();
  35. // void NotifyUpdateChannel();
  36. void UpdateChannelNow();
  37. BOOL ShowRButtonTIMenu(HWND hparent);
  38. LPCTSTR GetChannelByCmdID(DWORD m_cmdID);
  39. void OnPopupMenu(HMENU hmenu, int popuppos);
  40.     void    SetChannelRunning(BOOL b){channelrunning = b;}
  41. protected:
  42. int UserNetworkPos; //使用者的网络位置(教育网,电信网还是网通)
  43.     BOOL    PostAddPoint();         //增加积分
  44. BOOL GetChannelXML(); //获得XML文件内容存放在strXMLFile里面
  45. BOOL ParseChannelXML(HMENU hmenu); //生成一个频道地址的索引和一个频道的菜单
  46. BOOL useChannel; //是否使用频道菜单
  47. volatile BOOL channelthreadStop; //终止频道菜单管理线程的标记
  48. volatile LONG channeldataOK; //频道数据获取完成的标记
  49. volatile LONG updatechannel; //立刻更新频道请求的标记
  50.     volatile    BOOL    channelrunning;     //是否有频道在播放
  51. BOOL ParseDataOK; //在一次菜单处理过程中,频道数据已被正确解析过的标记
  52. private:
  53. CCritSec m_critsec_XMLFile;
  54. std::string strXMLFile;
  55. mystring xmlurl;
  56.     mystring    pointcookieurl;
  57.     mystring    pointurl;
  58. struct ChannelData
  59. {
  60. mystring name;
  61. mystring url;
  62. mystring desc;
  63. };
  64. std::vector<CChannelMenu::ChannelData> channellist;
  65. HMENU h_channelmenu;
  66. void MakePopupItem(CXML* pXML, HMENU hmenu, int isubgroup);
  67. HANDLE h_MenuThread;
  68. static unsigned int CALLBACK _GetMenuThreadProc(void* lpParameter);
  69. CTrayIconMenu* pTrayIconMenu;
  70. HttpRequest* pHttpSession;
  71. };
  72. enum TRAYCHANNELCMDID
  73. {
  74.     TRAYWM_ABOUT = WM_APP + 1,
  75. TRAYWM_EXIT,
  76. TRAYWM_HELP,
  77. TRAYWM_UPDATE,
  78. TRAYWM_HOMEPAGE,
  79.     TRAYWM_EMAIL,
  80.     TRAYWM_NETWORK,
  81. TRAYWM_UPDATECHANNEL = WM_APP + 40,
  82. TRAYWM_NETWORKSTART = WM_APP + 50,
  83. TRAYWM_NETWORKEND = WM_APP + 60,
  84. TRAYWM_CHANNELSTART = WM_APP + 200,
  85. TRAYWM_CHANNELEND = WM_APP + 1200,
  86. };
  87. #endif