| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- /**************************************************************************************************
- 版本所有(C), 2021-2022, 北京普达迪泰
- ***************************************************************************************************
- 文 件 名:Common.h
- 版 本 号: 1.00初版
- 作 者: HYF
- 生成日期:2021-12-20
- 最近修改:
- 功能描述: 公共函數
- 函数列表:
- 修改历史:
- 1.日 期 : 2012-3-20
- 作 者 : HYF
- 修改内容 : 创建文件
- **************************************************************************************************/
- #pragma once
- #include <afx.h>
- #include <string>
- #include "pch.h"
- using namespace std;
- class Utils
- {
- public:
- Utils(void);
- ~Utils(void);
- // 获取运行目录路径
- static CString GetExecDir(void);
- // 获取Web访问目录路径
- static CString GetLocalUrlDir(void);
- // 文件是否存在
- static BOOL IsFileExist(LPCTSTR lpFileName);
- // 目录是否存在
- BOOL DirectoryExists(LPCTSTR szFilePath);
- // 获取时间戳
- static INT64 GetCurrentTimeStamp();
- // 北京时间字串转时间戳
- static INT64 StringToTimeStamp(CString strInputTime);
- // 时间戳转北京时间字串
- static CString TimeStampToString(INT64 timestamp);
- // ANSI转UTF8
- static std::string ConverANSI2UTF8(const std::string & str);
- // ANSI转UNICODE
- static std::wstring ConverANSI2Unicode(const std::string str);
- // UTF8转UNICODE
- static std::wstring ConverUTF82Unicode(const std::string str);
- // UNICODE转UTF8
- static std::string ConverUnicode2UTF8(const std::wstring str);
- // UNICODE转ANSI
- static std::string ConverUnicode2ANSI(const std::wstring str);
- // UTF8转ANSI
- static std::string ConverUTF82ANSI(const std::string str);
- // 删除文件夹
- static BOOL DeleteFolder(const CString& strDirName);
- static BOOL SHDeleteFolder(const CString &szDir);
- // 移动文件夹
- static void MoveFolder(const CString& szSrc, const CString& szDes);
- // 创建自定义消息报文
- static DMSResponse* DMS_CreateMsg();
- // 释放消息
- static void DMS_FreeMsg(DMSResponse *pMsg);
- // IP地址转换:字符串转DWORD
- static DWORD IP_STR2DW(LPCTSTR szIP);
-
- // 字符串分割成字符串数组
- static int StrSplit(const CString& strLine, char split, CStringArray& strArray);
- static int StrSplit(const char *szLine, int iLen, char split, CStringArray& strArray);
- static int StrSplit(const CString& strLine, LPCTSTR split, CStringArray& strArray);
- static BOOL LoadImageFromResource(CImage *pImage, UINT nResID, LPCTSTR lpTyp);
- };
|