Global.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. // Global.h : 应用程序的全局变量、函数头文件
  2. //
  3. // 代码生成在 2014年9月25日, 09:55
  4. #ifndef __LYFZ_SERVERINFO_HEADER__
  5. #define __LYFZ_SERVERINFO_HEADER__
  6. #include <vector>
  7. #include <string>
  8. #include <shlwapi.h>
  9. #include ".\\includes\\gdiplus.h" ////请修改为你的头文件路径
  10. using namespace Gdiplus;
  11. #pragma comment(lib, ".\\lib\\gdiplus.lib") ////请修改为你的.lib文件路径
  12. #pragma once
  13. #define JEFF_TEST_ON 1 // 用于Jeff本人测试标识;
  14. #define JEFF_TEST_OFF 0 // 用于Jeff本人测试标识;
  15. #define JEFF_DELETE_ON 0 // 用于Jeff本人指示某段代码标识为删除状态;
  16. #define JEFF_DELETE_OFF 1 // 用于Jeff本人解除某段代码的删除状态;
  17. #define INSERT_SENDREG _T("insert into sendreg([msgtype],[phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s')")
  18. #define INSERT_SENDREGDELAY _T("insert into sendregdelay([msgtype],[phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values ('%s','%s','%s','%s','%s','%s','%s','%s','%s')")
  19. #define INSERT_SENDREG_OLD _T("insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values ('%s','%s','%s','%s','%s','%s','%s','%s')")
  20. #define INSERT_SENDREG2 _T("insert into [sendreg2]([phones],[content],[price],[yytime],[client],[type],[date],[ren]) values ('%s','%s','%s','%s','%s','%s','%s','%s')")
  21. // Jeff add 2014-12-11 分隔符;
  22. #define SEPARATOR _T("|")
  23. // 垫片类 - 安全锁;
  24. class SecurityKeylock
  25. {
  26. HANDLE _hMutex;
  27. public:
  28. SecurityKeylock(const TCHAR *pKeyName)
  29. {
  30. _hMutex = OpenMutex(MUTEX_ALL_ACCESS, FALSE, pKeyName);
  31. if (NULL == _hMutex)
  32. {
  33. _hMutex = CreateMutex(NULL, TRUE, pKeyName);
  34. // 如果CreateMutex失败……
  35. }
  36. else
  37. {
  38. WaitForSingleObject(_hMutex, INFINITE);
  39. }
  40. }
  41. ~SecurityKeylock()
  42. {
  43. if ((NULL != _hMutex) && ReleaseMutex(_hMutex))
  44. {
  45. CloseHandle(_hMutex);
  46. _hMutex = NULL;
  47. }
  48. }
  49. };
  50. typedef struct tagresdata2 // 用途?
  51. {
  52. BOOL bHasBk; //
  53. int nPicCount; //
  54. int nPicCount2; //
  55. DWORD nPicBmpCount[50]; // 为何设置魔数50?
  56. CRect rect[50]; // 为何设置魔数50?
  57. }RESDATA2;
  58. typedef struct tagUSER
  59. {
  60. int bLongin; // 是否登陆;
  61. CString name; // 用户名;
  62. CString rights; // 权限1;
  63. CString rights2; // 权限2;
  64. CString bm; // 用户部门;
  65. CString account; // 用户账号;
  66. CString m_discount; // 员工折扣?
  67. CString m_discount2; // 员工折扣2?
  68. CString level; // 文件夹权限等级?
  69. }USER;
  70. typedef struct
  71. {
  72. BOOL bsql;
  73. int server[50];
  74. int user[50];
  75. int psw[50];
  76. }DBSAVE;
  77. typedef struct
  78. {
  79. BYTE bsql;
  80. BYTE tabcount;
  81. BYTE code[100];
  82. DWORD count[100];
  83. DWORD length[100];
  84. }SENDHEAD;
  85. // Import or Export Image Typed
  86. typedef enum
  87. {
  88. ImageType_Original = 1,
  89. ImageType_Early = 2,
  90. ImageType_Further = 3,
  91. ImageType_Design = 4
  92. }IE_IMAGETYPE;
  93. typedef struct{
  94. CString strMD5;
  95. Image *pImage;
  96. }Annex, *pAnnex;
  97. extern DWORD g_arrFileVersion[4];
  98. extern TCHAR g_szLoginUser[MAX_PATH]; // 当前软件的登陆用户名;
  99. extern TCHAR g_szLoginPsw[MAX_PATH]; // 当前软件的登陆密码;
  100. extern TCHAR g_szModulePath[MAX_PATH]; // 软件目录;
  101. extern TCHAR g_szModuleFileName[MAX_PATH]; // 软件全名称;
  102. extern TCHAR g_szConnectString[MAX_PATH]; // DB连接串;
  103. extern TCHAR g_szHostComputerIP[MAX_PATH]; // 主机名称;
  104. extern DWORD g_dwCSPort; // 主机通信TCP端口;
  105. // 服务器信息;
  106. extern TCHAR g_szDBSource[MAX_PATH]; // 数据库源(服务所在IP或计算机名);
  107. extern TCHAR g_szDBSourcePort[MAX_PATH]; // 数据库源端口;
  108. extern DWORD g_dwDBServerPort; // 数据库源端口;
  109. extern TCHAR g_szDBAccount[MAX_PATH]; // 数据库登录用户;
  110. extern TCHAR g_szDBPassWord[MAX_PATH]; // 数据库登录密码;
  111. extern TCHAR g_szDBName[MAX_PATH]; // 数据库名称;
  112. extern TCHAR g_szShareHost[MAX_PATH];
  113. extern TCHAR g_szOriginalFolder[MAX_PATH];
  114. extern TCHAR g_szOriginalBkFolder[MAX_PATH];
  115. extern TCHAR g_szEarlyRepairFolder[MAX_PATH];
  116. extern TCHAR g_szEarlyRepairBkFolder[MAX_PATH];
  117. extern TCHAR g_szFurtherRepairFolder[MAX_PATH];
  118. extern TCHAR g_szFurtherRepairBkFolder[MAX_PATH];
  119. extern TCHAR g_szDesignFolder[MAX_PATH];
  120. extern TCHAR g_szDesignBkFolder[MAX_PATH];
  121. extern TCHAR g_szTelRecordingFolder[MAX_PATH];
  122. extern TCHAR g_szFullDressImageFolder[MAX_PATH];
  123. extern BOOL g_bSoftWareReg;
  124. extern CString g_strDogMainInfo;
  125. extern CString g_strMain;
  126. extern CStringArray g_strArrayOfBranchName;
  127. extern CStringArray g_strArrayOfBranchName2;
  128. extern CStringArray g_strArrayOfBranchIPAdress;
  129. extern CStringArray g_strArrayOfBranchDogMainInfo;
  130. extern unsigned int g_nCountOfAllowToConn;
  131. extern DWORD g_nLeng;
  132. extern BYTE *g_pData;
  133. extern DWORD g_nLeng2;
  134. extern BYTE *g_pData2;
  135. extern SENDHEAD g_sendhead;
  136. extern BOOL g_bRedSkin;
  137. extern COLORREF g_gridcol1;
  138. extern COLORREF g_gridcol2;
  139. extern COLORREF g_bkcol;
  140. extern COLORREF g_grid_red;
  141. extern COLORREF g_grid_blue;
  142. extern COLORREF g_grid_yellow;
  143. extern COLORREF g_grid_green;
  144. extern CString g_date; // 连接服务端时由服务端产生的CTime::GetCurrentTime().Format("%Y-%m-%d %H:%M:%S");
  145. extern CString g_title;
  146. extern CArray<CStringArray, CStringArray>g_AryStaff;
  147. extern CArray<CStringArray, CStringArray>g_cominfoarray;
  148. extern CArray<CStringArray, CStringArray>g_cominfoarraylocal;
  149. extern CArray<DWORD, DWORD>g_lengarray;
  150. extern CArray<DWORD, DWORD>g_btnlengarray;
  151. extern CArray<BYTE*, BYTE*>g_pointerarray;
  152. extern CBrush g_editbkbrush;
  153. extern DWORD g_btnleng[8];
  154. extern int g_btnlengpos;
  155. extern int g_nYearpos; // 是[historydb]表记录索引,即g_hisyeararray元素位置;
  156. extern CString g_branchname; // Jeff.集团版:????本分店名称;
  157. extern CString g_branchip;
  158. extern CString g_branchip2;
  159. extern BOOL g_bBranchModify;
  160. extern BOOL g_bShowOK; // Jeff:?
  161. extern BOOL g_bStaffAchievementShow; // 此机用于员工业绩查看;
  162. extern BOOL g_bSaveUploadTask1;
  163. extern BOOL g_bSaveUploadTask2;
  164. extern BOOL g_bSaveUploadTask3;
  165. extern BOOL g_bSaveUploadTask4;
  166. extern BOOL g_bSearchFilter; // 条件查询开关; == TRUE 开启条件查询, == FALSE 关闭条件查询;
  167. extern CString g_waiter1;
  168. extern CString g_waiter2;
  169. extern CString g_waiter3;
  170. extern CString g_waiter4;
  171. extern CString g_waiter5;
  172. extern CString g_filterdate1;
  173. extern CString g_filterdate2;
  174. extern CString g_filterdate3;
  175. extern CString g_filterdate4;
  176. extern CString g_filterdate5;
  177. extern CString g_filterdate6;
  178. extern CString g_filterbranch;
  179. extern USER g_user;
  180. extern CString g_mainpath; // 软件目录
  181. extern CString g_id; //
  182. extern CString g_server; // 服务端地址
  183. extern CStringArray g_serverarray; //
  184. extern CString g_serverbak; //
  185. extern CString g_path1; /* 共享目录 <客户原片(管理软件)$> 如:"\\lyfz-pc\客户原片(管理软件)$" */
  186. extern CString g_path2; /* 共享目录 <修好的片(管理软件)$> 如:"\\lyfz-pc\修好的片(管理软件)$" */
  187. extern CString g_path3; /* 共享目录 <设计好的片(管理软件$)> 如:""> */
  188. extern CString g_path4; /* 共享目录 <精修好的片(管理软件$)> 如:""> */
  189. extern CString g_path5; /* 共享目录 <礼服图片(管理软件$)> 如:""> */
  190. extern CString g_path6; /* 共享目录 <电话录音(管理软件$)> 如:""> */
  191. extern CString g_path7; /* 共享目录 <客户原片(管理软件$)\效果图> 如:""> */
  192. extern CString g_path1bak;
  193. extern CString g_path2bak;
  194. extern CString g_path3bak;
  195. extern CString g_path4bak;
  196. extern CString g_path5bak;
  197. extern CString g_path6bak;
  198. extern CString g_path7bak;
  199. extern CDatabase g_db;
  200. extern DWORD g_ncount;
  201. extern CFont g_titlefont;
  202. extern DWORD g_nSendCode;
  203. extern BOOL g_bSendOK;
  204. extern CArray<CStringArray, CStringArray>g_hisyeararray; // 表[historydb]里的记录;
  205. extern CArray<CStringArray, CStringArray>g_brancharray;
  206. extern CArray<CStringArray, CStringArray>g_oldclientarray;
  207. extern CArray<CStringArray, CStringArray>g_List1array;
  208. extern BOOL g_bNoConnDlg;
  209. extern BOOL g_bInSkin;
  210. extern int g_conntype;
  211. extern BOOL g_bGenBranchData;
  212. extern CString g_temp;
  213. extern BOOL g_bSortAscending;
  214. extern CFont g_listctrlfont;
  215. extern float g_fscalex;
  216. extern float g_fscaley;
  217. extern int g_screenwid; // 桌面宽
  218. extern int g_screenhei; // 桌面高
  219. extern float g_WidthScale; // 宽刻度Jeff
  220. extern float g_HeightScale; // 高刻度Jeff
  221. extern RESDATA2 g_resdata2;
  222. extern BOOL g_bAlphaWnd;
  223. extern BYTE g_bNeedDrawParent;
  224. extern BOOL g_bAllBranch;
  225. extern CString g_domain;
  226. extern CString g_sInfo;
  227. extern int g_ncot;
  228. extern int g_conpos;
  229. extern int g_nAutoShowStaffAchievement;
  230. extern BOOL g_bShowBar;
  231. extern int g_bookingtype;
  232. extern BOOL g_bNoLoginLia;
  233. extern BOOL g_bConnLYFZ;
  234. extern BOOL g_bSendLYFZ;
  235. extern int g_ntimeout;
  236. extern float g_WidthScale;
  237. extern float g_HeightScale;
  238. extern int g_dx;
  239. extern int g_dy;
  240. extern BOOL g_bNeedCoon;
  241. extern float g_WidthScale2 ;
  242. extern float g_HeightScale2 ;
  243. extern CStringArray g_menubranchname;
  244. // 屏幕区域;
  245. extern CRect g_rcScreen;
  246. // 对话框背景颜色;
  247. extern COLORREF g_clr_dlg;
  248. // ini文件路径;
  249. extern TCHAR g_szIniFile[MAX_PATH];
  250. //-----------------------------------------------------------------------------------------------------------------
  251. extern void LoadImageFromBuf(Bitmap **img, BYTE *pData, DWORD leng);
  252. extern void LoadImageFromBuf(Image **img, BYTE *pData, DWORD leng);
  253. extern void LoadImageFromBuf(Image **img, CString path);
  254. extern void LoadImageFromBuf(Bitmap **img, CString path);
  255. extern void LoadImageFromRes(Image **img, LPCTSTR lpszResourceName, LPCTSTR ResourceType);
  256. extern int GetOrientation(Image *image);
  257. extern int GetEncoderClsid(const WCHAR* format, CLSID* pClsid);
  258. extern void LoadImageFromFile(Image **img, CString path);
  259. extern void LoadImageFromFile(Bitmap **img, CString path);
  260. extern void SaveImageToFile(Image *img, CString path);
  261. extern void SaveImageToFile2(Image *img, CString path, ULONG quality);
  262. extern void IsWaiter2(CString id, CString name, CArray<CStringArray, CStringArray>*waiterarray, BOOL &bWait1, BOOL &bWait2, float &fscale1, float &fscale2, BOOL bCheckDate, CString date1, CString date2);
  263. extern void IsWaiter3(CString id, CString name, CArray<CStringArray, CStringArray>*waiterarray, BOOL &bWait1, BOOL &bWait2, float &fscale1, float &fscale2);
  264. extern CString GetNameFromDomain(CString domain);
  265. extern void GetSavePath(CString &path);
  266. extern CString GetW(CString str);
  267. extern CString GetK(CString str);
  268. extern CString GetB(CString str);
  269. extern CString GetS(CString str);
  270. extern CString GetG(CString str);
  271. extern CString GetHMoney(CString str);
  272. extern int GetYearPos(int year);
  273. extern void FillLength(CString &str, int length);
  274. extern BOOL myisdigit(CString str);
  275. extern BOOL IsHasRightsnew2(int pos, CString rights);
  276. extern CString GetIP(CString branch);
  277. extern void WriteTitle(CString str);
  278. extern BOOL IsHanZi(CString str);
  279. extern int GetType(CString str);
  280. extern CString FilterBZ(CString &bz);
  281. extern BOOL GIsHalfHZ(const CString &str);
  282. extern void RectFitDes(int width, int height, CRect &rc);
  283. extern bool CheckFolderFileExist(CString &strPath);
  284. extern int GetLengthEx(CString str);
  285. extern BOOL IsHasRights(int pos);
  286. extern BOOL IsHasRights2(int pos);
  287. extern BOOL IsHasRightsnew(int pos);
  288. extern BOOL IsHasRights2new(int pos);
  289. extern void FirstLetter(int nCode, CString& strLetter);
  290. extern void GetFirstLetter(CString strName, CString& strFirstLetter);
  291. extern CString newGUID();
  292. extern void ConvertToPrice(CString &str);
  293. extern DWORD FindAppProcessID(CString path);
  294. extern BOOL isInnerIP(DWORD a_ip);
  295. extern void MyGetIPByName(CString &name);
  296. extern void MyGetIPByName2(CString &name);
  297. extern CTime GetTmFromStr(CString date);
  298. extern int IsExistFolder(char *szPath);
  299. extern CString GetBranchPhotoPath(CString branch);
  300. extern CString GetDomainFromBranch(CString branch);
  301. extern BOOL CheckDateOK2(CString str);
  302. extern BOOL CheckBadWords(CString str, BOOL bMsg = 0);
  303. extern int CheckPhoneType(CString &phoneno);
  304. extern BOOL CheckDateOK(CString &str);
  305. extern int FindArray(CStringArray *pArray, const CString &Str);
  306. extern int GetSysIniInfo(const char *szPath = NULL, const char *szIniName = NULL);
  307. extern BOOL WaitWithMessageLoop(HANDLE hEvent, int nTimeout);
  308. extern BOOL IsFileExist(const TCHAR *pFileFullName);
  309. extern void DeleteDirectory(CString strDir);
  310. extern BOOL RegisterOcx(LPCTSTR ocxfile);
  311. extern BOOL GetDebugPriv();
  312. extern bool GetFileVersion(HMODULE hModule, WORD *pBuffer);
  313. extern BOOL GetProductVersion(IN HMODULE hModule, IN DWORD (&dwArray)[4] );
  314. extern BOOL CheckInternalIPV4(const unsigned int &ip_addr);
  315. extern BOOL IsValidIPV4(const TCHAR *szIP);
  316. extern int GetHostAllOfIP(const TCHAR *pHostName, std::vector<std::string> &vtHostIPV4);
  317. extern void DataToArray(
  318. CArray<CStringArray, CStringArray>*pArrayOfString,
  319. int datapos = -1);
  320. extern void DataToArray(
  321. CArray<CStringArray, CStringArray>*pArrayOfString1,
  322. CArray<CStringArray, CStringArray>*pArrayOfString2,
  323. int datapos = -1);
  324. extern void DataToArray(
  325. CArray<CStringArray, CStringArray>*pArrayOfString1,
  326. CArray<CStringArray, CStringArray>*pArrayOfString2,
  327. CArray<CStringArray, CStringArray>*pArrayOfString3,
  328. int datapos = -1);
  329. extern void DataToArray(
  330. CArray<CStringArray, CStringArray>*pArrayOfString1,
  331. CArray<CStringArray, CStringArray>*pArrayOfString2,
  332. CArray<CStringArray, CStringArray>*pArrayOfString3,
  333. CArray<CStringArray, CStringArray>*pArrayOfString4,
  334. int datapos = -1);
  335. extern void DataToArray(
  336. CArray<CStringArray, CStringArray>*pArrayOfString1,
  337. CArray<CStringArray, CStringArray>*pArrayOfString2,
  338. CArray<CStringArray, CStringArray>*pArrayOfString3,
  339. CArray<CStringArray, CStringArray>*pArrayOfString4,
  340. CArray<CStringArray, CStringArray>*pArrayOfString5,
  341. int datapos = -1);
  342. extern void DataToArray(
  343. CArray<CStringArray, CStringArray>*pArrayOfString1,
  344. CArray<CStringArray, CStringArray>*pArrayOfString2,
  345. CArray<CStringArray, CStringArray>*pArrayOfString3,
  346. CArray<CStringArray, CStringArray>*pArrayOfString4,
  347. CArray<CStringArray, CStringArray>*pArrayOfString5,
  348. CArray<CStringArray, CStringArray>*pArrayOfString6,
  349. int datapos = -1);
  350. extern void DataToArray(
  351. CArray<CStringArray, CStringArray>*pArrayOfString1,
  352. CArray<CStringArray, CStringArray>*pArrayOfString2,
  353. CArray<CStringArray, CStringArray>*pArrayOfString3,
  354. CArray<CStringArray, CStringArray>*pArrayOfString4,
  355. CArray<CStringArray, CStringArray>*pArrayOfString5,
  356. CArray<CStringArray, CStringArray>*pArrayOfString6,
  357. CArray<CStringArray, CStringArray>*pArrayOfString7,
  358. int datapos = -1);
  359. extern void DataToArray(
  360. CArray<CStringArray, CStringArray>*pArrayOfString1,
  361. CArray<CStringArray, CStringArray>*pArrayOfString2,
  362. CArray<CStringArray, CStringArray>*pArrayOfString3,
  363. CArray<CStringArray, CStringArray>*pArrayOfString4,
  364. CArray<CStringArray, CStringArray>*pArrayOfString5,
  365. CArray<CStringArray, CStringArray>*pArrayOfString6,
  366. CArray<CStringArray, CStringArray>*pArrayOfString7,
  367. CArray<CStringArray, CStringArray>*pArrayOfString8,
  368. int datapos = -1);
  369. extern void DataToArray(
  370. CArray<CStringArray, CStringArray>*pArrayOfString1,
  371. CArray<CStringArray, CStringArray>*pArrayOfString2,
  372. CArray<CStringArray, CStringArray>*pArrayOfString3,
  373. CArray<CStringArray, CStringArray>*pArrayOfString4,
  374. CArray<CStringArray, CStringArray>*pArrayOfString5,
  375. CArray<CStringArray, CStringArray>*pArrayOfString6,
  376. CArray<CStringArray, CStringArray>*pArrayOfString7,
  377. CArray<CStringArray, CStringArray>*pArrayOfString8,
  378. CArray<CStringArray, CStringArray>*pArrayOfString9,
  379. CArray<CStringArray, CStringArray>*pArrayOfString10,
  380. int datapos = -1);
  381. extern inline int MultiByteLengthConvertToWideCharLength(/*LPCSTR*/LPCCH lpString);
  382. extern void lyfzImportImage(LPCTSTR lpDestDirectory, CStringArray &strArrayOfImage, const BOOL &bFailIfExists = TRUE);
  383. extern BOOL lyfzCopyFileEx(LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, const BOOL &bFailIfExists = TRUE);
  384. extern BOOL lyfzCreateDirectory(LPCTSTR lpDestDirectory);
  385. extern void lyfzSplitpath(const char *path, char *drive, char *dir, const int &nTimes);
  386. extern void ShowSystemErrorInfo(CString &strDescription, const DWORD &dwError);
  387. extern void WriteClientLog(const CString &strLogContent);
  388. extern BOOL IsDirectoryLegitimate(const CString &strDirectory);
  389. extern void ExportCutImageToFile(LPCCH lpOrderCutImageInfo, LPCCH lpSrcDirectory, LPCCH lpSaveDirectory);
  390. extern BOOL AnalysisImagInfo(CStringArray &saSrcPhoto, LPCCH strSrcDirectory, LPCCH strSaveDirectory, CString &strImageInfo, CString &strImageName, CString &strCutScheme, CRect &rtCut);
  391. extern int GetCountOfOrderFolderPhotoFile( const TCHAR *pOrderFolder, CStringArray &StrPhotoArray);
  392. extern COleDateTime GetDateTimeByString(CString strDateTime);
  393. #endif