Global.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. //////////////////////////////////////////////////////////////////////////////
  2. ////// //////
  3. ////// 文 件: Global.cpp //////
  4. ////// 作 者: sailing //////
  5. ////// 创建时间: 2008-08-20 //////
  6. ////// 说 明: 定义全局变量,全局函数 //////
  7. ////// //////
  8. ////// 修改时间: //////
  9. ////// 修改说明: //////
  10. ////// //////
  11. //////////////////////////////////////////////////////////////////////////////
  12. #pragma once
  13. #include "stdafx.h"
  14. //版本信息
  15. CString g_strVersion = "3.0.3.2";
  16. //程序退出事件
  17. HANDLE g_hRunObject = NULL;
  18. //Server
  19. CHAR g_strServerIP[MAX_EQUIP_IP + 1] = {0};
  20. CHAR g_strServerPort[MAX_PORT + 1] = {0};
  21. //Database
  22. CHAR g_strConnectString[MAX_PATH + 1] = ""; // 数据连接字符串
  23. CHAR g_strDBType[MAX_SERVER_LENGTH + 1] = ""; // 数据库连接类型(如: SQL SERVER 、Access )
  24. CHAR g_strAccessFile[MAX_PATH_LENGTH + 1] = ""; // 如果是用Access数据库:Access文件名称
  25. // 如用其它数据库:为空
  26. CHAR g_strServerName[MAX_SERVER_LENGTH + 1] = ""; // 数据库服务器名称或IP
  27. CHAR g_strDataBaseName[MAX_DATABASE_LENGTH + 1] = ""; // 数据库名称
  28. CHAR g_strUserName[MAX_USER_LENGTH + 1] = ""; // 数据库用户名
  29. CHAR g_strPassword[MAX_PASSWORD_LENGTH + 1] = ""; // 数据库密码
  30. //用户信息
  31. CHAR g_strLoginUserID[MAX_USER_LENGTH + 1] = ""; // 当前使用该软件的用户名
  32. CHAR g_strLoginPwd[MAX_PASSWORD_LENGTH + 1] = ""; // 当前使用该软件的密码
  33. CHAR g_strDefaultUserID[MAX_USER_LENGTH + 1] = {0};
  34. CHAR g_strDefaultUserPwd[MAX_PASSWORD_LENGTH + 1] = {0};
  35. INT g_nIsDemo = 0;
  36. CString g_strCommunity = "public";
  37. bool g_bHaveControlPwd = true;
  38. DWORD g_nRunEditVarTick;//在运行状态编辑变量的TICK
  39. bool g_bRunEditVar;//是否在运行状态编辑变量
  40. //RunParam
  41. INT g_nIsPoll = 0;
  42. INT g_nPollInterval = 0;
  43. INT g_nPollCount = 0;
  44. CHAR g_strPollPath[MAX_VIEW_NUM][MAX_PATH] = {0};
  45. CHAR g_strPollDesc[MAX_VIEW_NUM][MAX_DESC] = {0};
  46. INT g_nPollIndex = 0;
  47. DWORD g_dwTick = 0;
  48. //AlarmMode
  49. INT g_nAlarmModeIsDlg = 0;
  50. INT g_nAlarmModeIsSound = 0;
  51. INT g_nAlarmModeSoundPlayNum = 0;
  52. INT g_nAlarmToView = 0;
  53. //Comm
  54. INT g_nCommDlgLevel = 0;
  55. INT g_nCommWavLevel = 0;
  56. //TTS参数配置
  57. INT g_nTTSType = 5; // TTS格式类型
  58. //Toolbar显示选项
  59. INT g_nToolbarTop = 0;
  60. INT g_nToolbarLeft = 0;
  61. INT g_nToolbarRun = 0;
  62. INT g_nToolBarStatus = 0;
  63. //用户权限
  64. vector<int> g_vtUserGroupID;
  65. vector<int> g_vtUserRoomID;
  66. vector<__USEREQUIPINFO> g_vtUserEquipInfo;
  67. vector<__USERROLEINFO> g_vtUserRoleInfo;
  68. vector<__USERTELINFO> g_vtUserTelInfo;
  69. bool g_bPurviewAddEquip = FALSE;
  70. bool g_bPurviewAddMobusEquip = FALSE;
  71. bool g_bPurviewSetIP = FALSE;
  72. bool g_bPurviewEquipTypeInfoManager = FALSE;
  73. bool g_bPurviewEquipTypeInfoRead = FALSE;
  74. bool g_bPurviewAreaInfoManager = FALSE;
  75. bool g_bPurviewAreaInfoRead = FALSE;
  76. bool g_bPurviewRoomInfoManager = FALSE;
  77. bool g_bPurviewRoomInfoRead = FALSE;
  78. bool g_bPurviewUserInfoManager = FALSE;
  79. bool g_bPurviewUserInfoRead = FALSE;
  80. bool g_bPurviewUserGroupInfoManager = FALSE;
  81. bool g_bPurviewUserGroupInfoRead = FALSE;
  82. bool g_bPurviewUserGroupPurviewManager = FALSE;
  83. bool g_bPurviewUserPurviewManager = FALSE;
  84. bool g_bPurviewUserDatePlan = FALSE;
  85. bool g_bPurviewPurviewInfoManager = FALSE;
  86. bool g_bPurviewPurviewInfoRead = FALSE;
  87. bool g_bPurviewSPEquipManager = FALSE;
  88. bool g_bPurviewSPEquipRead = FALSE;
  89. bool g_bPurviewSensorManager = FALSE;
  90. bool g_bPurviewSensorRead = FALSE;
  91. bool g_bPurviewRelayControl = FALSE;
  92. bool g_bPurviewVideoContorl = FALSE;
  93. bool g_bPurviewEquipDatePlan = FALSE;
  94. bool g_bPurviewRouterEquipManager = FALSE;
  95. bool g_bPurviewRouterEquipRead = FALSE;
  96. bool g_bPurviewUpsManager = FALSE;
  97. bool g_bPurviewUpsRead = FALSE;
  98. bool g_bPurviewVideoEquipManager = FALSE;
  99. bool g_bPurviewVideoEquipRead = FALSE;
  100. bool g_bPurviewTEPWManager = FALSE;
  101. bool g_bPurviewTEPWRead = FALSE;
  102. bool g_bPurviewUpsMGEManager = FALSE;
  103. bool g_bPurviewUpsMGERead = FALSE;
  104. bool g_bPurviewMcQuayManager = FALSE;
  105. bool g_bPurviewMcQuayRead = FALSE;
  106. bool g_bPurviewHGManager = FALSE;
  107. bool g_bPurviewHGRead = FALSE;
  108. bool g_bPurviewLeakageManager = FALSE;
  109. bool g_bPurviewLeakageRead = FALSE;
  110. bool g_bPurviewAirConditionManager = FALSE;
  111. bool g_bPurviewAirConditionRead = FALSE;
  112. bool g_bPurviewAirConditionOpen = FALSE;
  113. bool g_bPurviewAirConditionClose = FALSE;
  114. bool g_bPurviewCFIManager = FALSE;
  115. bool g_bPurviewCFIRead = FALSE;
  116. bool g_bPurviewEquipAlloc = FALSE;
  117. //Dog
  118. HANDLE g_hSemDogRead = NULL;
  119. char g_szDogData[10] = {0};
  120. //日志
  121. CHAR g_strDirectory[MAX_PATH_LENGTH + 1]; // 软件所在路径
  122. CHAR g_strAppName[MAX_PATH_LENGTH + 1] = {0}; // 软件名称
  123. //视频采集卡
  124. INT g_nCardCount = 0; // 板卡个数
  125. INT g_nDspsCount = 0; // 正确编码的通道个数
  126. INT g_nStartingCapture[64] = {0}; // 录像状态
  127. CHAR g_strVideoCapPath[MAX_PATH + 1] = {0}; // 视频录像保存路径
  128. //系统设置
  129. BOOL g_bEnableTimeLimited = FALSE; // TRUE:时间限制 FALSE:正式版
  130. INT g_iAutoRunSystem = 0; // 是否开机自启动该系统
  131. CHAR g_strLanguage[MAX_LANG_LENGTH + 1]={0}; // 默认语言
  132. //视频卡
  133. //视频选项卡标题
  134. CString g_strVideoTabMonitorTitle;
  135. CString g_strVideoTabPlaybackTitle;
  136. //界面语言
  137. CString g_strEquipExist;
  138. CString g_strLogTypeEvent;
  139. CString g_strLogTypeData;
  140. CString g_strLogTypeError;
  141. CString g_strLogTypeWarning;
  142. CString g_strLogModMainThread;
  143. CString g_strLogModDB;
  144. CString g_strLogModEmail;
  145. CString g_strLogModSms;
  146. CString g_strLogModPing;
  147. CString g_strLogModTrap;
  148. CString g_strLogModSnmp;
  149. CString g_strLogModDog;
  150. CString g_strLogModNotice;
  151. CString g_strLogModContents;
  152. CString g_strLogModTime;
  153. BOOL g_bRun; //运行否
  154. BOOL g_bEdit; //编辑否
  155. int g_nElementNo; //选中的元件编号
  156. CString g_strViewName;
  157. CString g_sCurrentPageName;
  158. int g_nUserID; //当前用户的ID
  159. // 系统参数
  160. BOOL g_bAlarmVoice;
  161. BOOL g_bHideTask;
  162. CString g_strStartPic;
  163. CString g_strStartPath;
  164. BOOL g_bStartRun = TRUE;
  165. BOOL g_bEventAlarm;
  166. BOOL g_bFullScreen;
  167. // 事件参数
  168. BOOL g_bControlEvent;
  169. CString g_strYkWave;
  170. BOOL g_bLoginEvent;
  171. CString g_strLoginWave;
  172. BOOL g_bReguEvent;
  173. CString g_strReguWave;
  174. BOOL g_bSetEvent;
  175. CString g_strSetWave;
  176. BOOL g_bYcEvent;
  177. CString g_strYcWave;
  178. BOOL g_bYxChangeEve;
  179. CString g_strYxChangeWave;
  180. //错误代码,提示
  181. CHAR g_strErrorExecSql[MAX_ERROR_LEN + 1] = {0};
  182. CHAR g_strErrorDBDisConnection[MAX_ERROR_LEN + 1] = {0};
  183. //告警提示
  184. CHAR g_strMsgSelectDel[MAX_ERROR_LEN + 1] = {0};
  185. CHAR g_strMsgConfirmDel[MAX_ERROR_LEN + 1] = {0};
  186. CHAR g_strMsgEditSuccess[MAX_ERROR_LEN + 1] = {0};
  187. CHAR g_strMsgSelectEdit[MAX_ERROR_LEN + 1] = {0};
  188. CHAR g_strMsgUserNotNULL[MAX_ERROR_LEN + 1] = {0};
  189. CHAR g_strMsgPwdNotNULL[MAX_ERROR_LEN + 1] = {0};
  190. CHAR g_strMsgUserInvalid[MAX_ERROR_LEN + 1] = {0};
  191. CHAR g_strMsgConfirmDelRecord[MAX_ERROR_LEN + 1] = {0};
  192. CHAR g_strMsgPrompt[MAX_ERROR_LEN + 1] = {0};
  193. CHAR g_strMsgUserDisable[MAX_ERROR_LEN + 1] = {0};
  194. CHAR g_strMsgDBConnectionSuccess[MAX_ERROR_LEN + 1] = {0};
  195. CHAR g_strMsgDBConnectionFail[MAX_ERROR_LEN + 1] = {0};
  196. //资源字符串
  197. CString g_strSet;
  198. CString g_strAdjust;
  199. CString g_strTestAlarm;
  200. CString g_strExit;
  201. CString g_strExLink;
  202. CString g_strPictureLink;
  203. CString g_strAlarmRed;
  204. CString g_strNoticeRed;
  205. CString g_strDeviceLog;
  206. CString g_strSystemLog;
  207. CString g_strVarManage;
  208. CString g_strUserManage;
  209. CString g_strPwdManage;
  210. CString g_strFirstPage;
  211. CString g_strNativageTree;
  212. CString g_strVarTypeID;
  213. CString g_strSelLine;
  214. CString g_strVarID;
  215. CString g_strVarUid1;
  216. CString g_strVarName1;
  217. CString g_strVarDesc;
  218. CString g_strVarDataLen;
  219. CString g_strOnDesc;
  220. CString g_strOffDesc;
  221. CString g_strMaxValues;
  222. CString g_strMinValues;
  223. CString g_strMaxScale;
  224. CString g_strMinScale;
  225. CString g_strLowerLimit;
  226. CString g_strUpperLimit;
  227. CString g_strNormalState;
  228. CString g_strSetValue;
  229. CString g_strRearm;
  230. CString g_strOffset;
  231. CString g_strUint;
  232. CString g_strCollectFreq;
  233. CString g_strCoef;
  234. CString g_strAlarmLevel;
  235. CString g_strReadWrite;
  236. CString g_strSaveData;
  237. CString g_strCollectThreadData;
  238. CString g_strSaveCurve;
  239. CString g_strIsDDE;
  240. CString g_strRegNum;
  241. CString g_strFuncID;
  242. CString g_strChildID;
  243. CString g_strItemID;
  244. CString g_strSnmpOid;
  245. CString g_strSnmpPublic;
  246. CString g_strDevTypeID;
  247. CString g_strVarStartAddr;
  248. CString g_strRs232Cmd;
  249. CString g_strRs232Type;
  250. CString g_strRs232Index;
  251. CString g_strIndentifyTime;
  252. CString g_strRedectTime;
  253. CString g_strReturnNormalAlarm;
  254. CString g_strShowCurrValue;
  255. CString g_strAlarmVarName;
  256. CString g_strVarUidIsBlank;
  257. CString g_strVarNameIsBlank;
  258. CString g_strVarNameExist;
  259. CString g_strVarName2;
  260. CString g_strSelDev;
  261. CString g_strStoneuTech;
  262. CString g_strPictureFile1;
  263. CString g_strCannotLoseAllForm;
  264. CString g_strStartBit;
  265. CString g_strEndBit;
  266. CString g_strVarBitExist;
  267. CString g_strSelDevice;
  268. CString g_strOldPasswordCannotBlank;
  269. CString g_strOldpasswordInCorrect;
  270. CString g_strpasswordInCorrect;
  271. CString g_strPasswordNotMatch1;
  272. CString g_strAll;
  273. CString g_strDevName;
  274. CString g_strHappentTime1;
  275. CString g_strEventArea;
  276. CString g_strCurrValue;
  277. CString g_strDateTime;
  278. CString g_strHappenTime2;
  279. CString g_strWarnContent;
  280. CString g_strAllDev;
  281. CString g_strEthernet;
  282. CString g_strMywizard;
  283. CString g_strDevNameInUse;
  284. CString g_strUserID;
  285. CString g_strHintUserName;
  286. CString g_strTel;
  287. CString g_strMobile;
  288. CString g_strFax;
  289. CString g_strMail;
  290. CString g_strStatus;
  291. CString g_strUserPwd;
  292. CString g_strUserNameCannotEmpty;
  293. CString g_strPasswordNotMatch2;
  294. CString g_strUserNameExit;
  295. CString g_strID;
  296. CString g_strDevUid2;
  297. CString g_strAlarmStatus;
  298. CString g_strAlarmStatusDesc;
  299. CString g_strNormalStatusID;
  300. CString g_strAlarmStatusIDCannotEmpty;
  301. CString g_strAlarmStatusDescCannotEmpty;
  302. CString g_strNormalStatusIDCannotBlank;
  303. CString g_strAlarmStatusInfoExist;
  304. CString g_strTimesNewRoman;
  305. CString g_strEntityProperty;
  306. CString g_strParamSet;
  307. CString g_strHour;
  308. CString g_strDate;
  309. CString g_strMean;
  310. CString g_strControl;
  311. CString g_strTRACE0;
  312. CString g_strAppwizardCreateApp;
  313. CString g_strPictureFile2;
  314. CString g_strSaveModify;
  315. CString g_strStoneuIspcms;
  316. CString g_strUnSelectEntity;
  317. CString g_strIsNotPrimitive;
  318. CString g_strSelect;
  319. CString g_strTrace2;
  320. CString g_strTline;
  321. CString g_strText;
  322. CString g_strRect;
  323. CString g_strOval;
  324. CString g_strButton;
  325. CString g_strData;
  326. CString g_strLed;
  327. CString g_strBar;
  328. CString g_strCurve;
  329. CString g_strLine;
  330. CString g_strBreaker;
  331. CString g_strSwitch;
  332. CString g_strGrid;
  333. CString g_strBitmap;
  334. CString g_strGif;
  335. CString g_strTransfer;
  336. CString g_strArc;
  337. CString g_strArrow;
  338. CString g_strPoly;
  339. CString g_strMLine;
  340. CString g_strPipe;
  341. CString g_strZhePipe;
  342. CString g_strYPipe;
  343. CString g_strWatch;
  344. CString g_strSingleBar;
  345. CString g_strRoundRect;
  346. CString g_strPie;
  347. CString g_strFan;
  348. CString g_strHisCurve;
  349. CString g_strTable;
  350. CString g_strComposite;
  351. CString g_strConnectionFailed;
  352. CString g_strMoniterSite;
  353. CString g_strDevice;
  354. CString g_strSerial;
  355. CString g_strDataDict;
  356. CString g_strVarSet;
  357. CString g_strScriptManage;
  358. CString g_strActionWithAlarm;
  359. CString g_strNoticeList;
  360. CString g_strSysParam;
  361. CString g_strExitConfirm;
  362. CString g_strIPComoccupy;
  363. CString g_strDevNumCannotBlank;
  364. CString g_strDevUidExist;
  365. CString g_strDevNameExist;
  366. CString g_strSerialPortInUse;
  367. CString g_strIPNotBlank;
  368. CString g_strComcanNot0;
  369. CString g_strNetDev;
  370. CString g_strIPConflict;
  371. CString g_strCannotCreateDirecitory;
  372. CString g_strDelDev;
  373. CString g_strDelView;
  374. CString g_strConfirm;
  375. CString g_strEventType;
  376. CString g_strEventInfo;
  377. CString g_strLowAlarm;
  378. CString g_strHighAlarm;
  379. CString g_strReturnNormal1;
  380. CString g_strReturnNormal2;
  381. CString g_strAlarm;
  382. CString g_strTime;
  383. CString g_strVarName3;
  384. CString g_strColumnName;
  385. CString g_strHeader;
  386. CString g_strFormat;
  387. CString g_strScriptPass;
  388. CString g_strScriptNameCannotEmpty;
  389. CString g_strStrVar;
  390. CString g_strDes;
  391. CString g_strOne;
  392. CString g_strTwo;
  393. CString g_strThree;
  394. CString g_strFour;
  395. CString g_strFine;
  396. CString g_strSix;
  397. CString g_strSeven;
  398. CString g_strEight;
  399. CString g_strNine;
  400. CString g_strTen;
  401. CString g_strHandred;
  402. CString g_strBilion;
  403. CString g_strWan;
  404. CString g_strThousand;
  405. CString g_strYuan1;
  406. CString g_strCent;
  407. CString g_strZero;
  408. CString g_strMinute;
  409. CString g_strYuan2;
  410. CString g_strDevDataLog;
  411. CString g_strOverWriteError;
  412. CString g_strSaveas;
  413. CString g_strTip;
  414. CString g_strScriptError;
  415. CString g_strLogicDoorinate;
  416. CString g_strFontNameCHT;
  417. CString g_strCharacter;
  418. CString g_strNormal;
  419. CString g_strIsNotice;
  420. CString g_strIsModify;
  421. CString g_strParamInit;
  422. CString g_strParamMin;
  423. CString g_strParamMax;
  424. CString g_strOCX;
  425. CString g_strGIF;
  426. CString g_strFlash;
  427. CString g_strRadio;
  428. CString g_strCheck;
  429. CString g_strLogType;
  430. CString g_strModbusType;
  431. CString g_strLogContent;
  432. CString g_strLogHappenTime;
  433. CString g_strNoPermit;
  434. CString g_strModifyPwdOK;
  435. CString g_strMonitorNameIsBlank;
  436. CString g_strMonitorNameCannotDel;
  437. CString g_strInputIsBlank;
  438. CString g_strPastDue;
  439. CString g_strEditMoreVarOK;
  440. CString g_strGroup;
  441. CString g_strDClickFirstOperate;
  442. CString g_strDelGroup;
  443. CString g_strNormalData;
  444. CString g_strAlarmData;
  445. CString g_strDealStatus;
  446. CString g_strAC_WaitConfig;
  447. CString g_strAC_ConfigSuccess;
  448. CString g_strAC_WaitOut;
  449. CString g_strAC_ConfigAllEvent;
  450. CString g_strAC_ConfigChooseEvent;
  451. CString g_strAC_DelAllEvent;
  452. CString g_strAC_DelChooseEvent;
  453. CString g_strAdd;
  454. CString g_strEdit;
  455. CString g_strDel;
  456. CString g_strDevice1;
  457. CString g_strVariant;
  458. CString g_strUser;
  459. CString g_strPwd;
  460. CString g_strTimePlan;
  461. CString g_strRegiserOCX;
  462. HINSTANCE g_hLangDLL;
  463. //视频采集卡动态库输出函数
  464. HINSTANCE g_hVideoLibModule = NULL;
  465. MySTONEU_DLLCreateVideoView pStoneUDllCreateVideoView = NULL;
  466. MySTONEU_DLLGetTotalBoardCount pStoneUDllGetTotalBoardCount = NULL;
  467. MySTONEU_DLLGetTotalDSPCount pStoneUDllGetTotalDSPCount = NULL;
  468. MySTONEU_DLLGetDspCount pStoneUDllGetDSPCount = NULL;
  469. MySTONEU_DLLInitHCCard pStoneUDllInitHCCard = NULL;
  470. MySTONEU_DLLUnInitHCCard pStoneUDllUnInitHCCard = NULL;
  471. MySTONEU_DLLDestroyVideoView pStoneUDllDestroyVideoView = NULL;
  472. MySTONEU_DLLChannelDblClk pStoneUDllChannelDblClk = NULL;
  473. MySTONEU_DLLStartCap pStoneUDllStartCap = NULL;
  474. MySTONEU_DLLStopCap pStoneUDllStopCap = NULL;
  475. MySTONEU_DLLStartMotionDetection pStoneUDllStartMotionDetection = NULL;
  476. MySTONEU_DLLStopMotionDetection pStoneUDllStopMotionDetection = NULL;
  477. MySTONEU_DLLVideoCapCallBack pStoneUDllVideoCapCallBack = NULL;
  478. MySTONEU_DLLSetCapPath pSetCapPath = NULL;
  479. // TTS输出函数
  480. HINSTANCE g_hTTSModule = NULL;
  481. MySTONEU_DLLRegisterTTS pStoneUDllRegisterTTS = NULL;
  482. MySTONEU_DLLUnRegisterTTS pStoneUDllUnRegisterTTS = NULL;
  483. MySTONEU_DLLTxtToWav pStoneUDLLTxtToWav = NULL;
  484. ///////////////////////////////////////////////////////////////////////////////////////////////
  485. ////// 函数名称:GetTokens ///////
  486. ////// 函数说明:根据sDelimiter变量的拆分规则,把sSource源字符串拆分成多个 ///////
  487. ////// 字符串,并传入pTokens变量 ///////
  488. ////// 参数列表:pTokens -- 目标字符串存放指针 ///////
  489. ////// sSource -- 源字符串 ///////
  490. ////// sDelimiter -- 指定的拆分字符 ///////
  491. ////// 作 者:sailing ///////
  492. ////// 创者时间:2008-11-24 ///////
  493. ///////////////////////////////////////////////////////////////////////////////////////////////
  494. void GetTokens(CStringArray * pTokens, CString sSource, CString sDelimiter)
  495. {
  496. pTokens->RemoveAll();
  497. //开始解析
  498. int nStart = 0;
  499. int nLen = sDelimiter.GetLength();
  500. while(true)
  501. {
  502. int i = sSource.Find(sDelimiter, nStart);
  503. if(i < 0)
  504. break;
  505. if(i >= nStart)
  506. {
  507. CString s = sSource.Mid(nStart, i - nStart);
  508. pTokens->Add(s);
  509. }
  510. nStart = i + nLen;
  511. }
  512. //剩下的字符串
  513. if(nStart <= sSource.GetLength())
  514. pTokens->Add(sSource.Mid(nStart));
  515. }
  516. BOOL UserRoomHasPurview( int nRoomID )
  517. {
  518. int i, nSize;
  519. BOOL bFind = FALSE;
  520. nSize = g_vtUserRoomID.size();
  521. for( i = 0; i < nSize; i++ )
  522. {
  523. if( g_vtUserRoomID[i] == nRoomID )
  524. {
  525. bFind = TRUE;
  526. }
  527. }
  528. return bFind;
  529. }