Global.cpp 17 KB

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