duanjianjun 2 سال پیش
کامیت
b2e6e85798

+ 1200 - 0
MFCApplication1/BaseUtility.cpp

@@ -0,0 +1,1200 @@
+#include "pch.h"
+#include "BaseUtility.h"
+#include <odbcinst.h>
+#include <comdef.h>
+#include <afxdb.h>
+#include <regex>
+
+typedef basic_string<char>::size_type S_T;
+
+
+bool IsLeap(int year)  
+{  
+    if((year%4==0&&year%100!=0)||year%400==0) 
+        return true;  
+    else  
+        return false;  
+}
+
+bool IsWeekEnd(int year, int month, int day)
+{
+	struct tm	stTime = {0};
+	struct tm	*ptr = NULL;
+	time_t		time;
+
+	stTime.tm_year = year - 1900;
+	stTime.tm_mon = month - 1;
+	stTime.tm_mday = day;
+	time = mktime(&stTime);
+
+	ptr = localtime(&time);
+	return (ptr->tm_wday == 0 || ptr->tm_wday == 6);
+}
+
+bool Nextday(int& year, int& month, int& day)
+{
+	short ld[12]={31,28,31,30,31,30,31,31,30,31,30,31};
+
+	if (!(!(year%100)&&(year%400)) && !(year%4))
+		ld[1]++;
+	day++;
+	if (day<=0 || day>(unsigned long)ld[month-1])
+	{
+		day = 1;  month++;
+		if(month>12)
+		{
+			month = 1; year++;
+		}
+	}
+	return true;
+}
+
+void Full2Half(wchar_t* str)
+{
+	if(str != NULL)
+	{
+		int len = wcslen(str);
+
+		int i = 0;
+		wchar_t space[] = L" ";
+
+		for(; i<len; i++)
+		{
+			if(str[i] == space[0])//对空格特殊处理
+			{
+				str[i] = ' ';
+			}
+			else if(str[i] >= 65281 && str[i] <= 65374)
+			{
+				str[i] -= (65281 - 33);
+			}
+		}
+	}
+}
+
+bool split(const tstring& src, tstring delimit,vector<tstring> &v, tstring null_subst)
+{
+	if(src.empty() || delimit.empty()) 
+		return false;    
+	S_T deli_len = delimit.size();  
+	long index = -1,last_search_position = 0;  
+	while( (index=src.find(delimit,last_search_position))!=-1 )  
+	{  
+		if(index==last_search_position)  
+			v.push_back(null_subst);  
+		else  
+			v.push_back( src.substr(last_search_position, index-last_search_position) );  
+		last_search_position = index + deli_len;  
+	}  
+	tstring last_one = src.substr(last_search_position);
+	v.push_back( last_one.empty()? null_subst:last_one );  
+	return true;
+}
+
+bool split(const string& src, string delimit, vector<string> &v, string null_subst)
+{
+	if (src.empty() || delimit.empty())
+		return false;
+	S_T deli_len = delimit.size();
+	long index = -1, last_search_position = 0;
+	while ((index = src.find(delimit, last_search_position)) != -1)
+	{
+		if (index == last_search_position)
+			v.push_back(null_subst);
+		else
+			v.push_back(src.substr(last_search_position, index - last_search_position));
+		last_search_position = index + deli_len;
+	}
+	string last_one = src.substr(last_search_position);
+	v.push_back(last_one.empty() ? null_subst : last_one);
+	return true;
+}
+
+vector<tstring> splitEx(const tstring& src, tstring separate_character)
+{
+	vector<tstring> strs;
+
+	int separate_characterLen = separate_character.size();//分割字符串的长度,这样就可以支持如“,,”多字符串的分隔符   
+	int lastPosition = 0, index = -1;
+	while (-1 != (index = src.find(separate_character, lastPosition)))
+	{
+		strs.push_back(src.substr(lastPosition, index - lastPosition));
+		lastPosition = index + separate_characterLen;
+	}
+	tstring lastString = src.substr(lastPosition);//截取最后一个分隔符后的内容   
+	if (!lastString.empty())
+		strs.push_back(lastString);//如果最后一个分隔符后还有内容就入队   
+	return strs;
+}
+
+vector<string> splitEx(const string& src, string separate_character)
+{
+	vector<string> strs;
+
+	int separate_characterLen = separate_character.size();//分割字符串的长度,这样就可以支持如“,,”多字符串的分隔符   
+	int lastPosition = 0, index = -1;
+	while (-1 != (index = src.find(separate_character, lastPosition)))
+	{
+		strs.push_back(src.substr(lastPosition, index - lastPosition));
+		lastPosition = index + separate_characterLen;
+	}
+	string lastString = src.substr(lastPosition);//截取最后一个分隔符后的内容   
+	if (!lastString.empty())
+		strs.push_back(lastString);//如果最后一个分隔符后还有内容就入队   
+	return strs;
+}
+
+int GB2312_2_UTF8(char* buf, int buf_len, const char* src, int src_len)
+{
+	int i = 0, j = 0;
+
+	if (0 == src_len)
+	{
+		src_len = strlen(src);
+	}
+
+	for (i = 0; i < src_len;)
+	{
+		if (j >= buf_len - 1)
+			break;
+
+		if (src[i] >= 0)
+		{
+			buf[j++] = src[i++];
+		}
+		else
+		{
+			unsigned short w_c = 0;
+			char tmp[4] = "";
+			Gb2312_2_Unicode(&w_c, src + i);
+
+			Unicode_2_UTF8(tmp, &w_c);
+
+			buf[j+0] = tmp[0];
+			buf[j+1] = tmp[1];
+			buf[j+2] = tmp[2];
+
+			i += 2;
+			j += 3;
+		}
+	}
+
+	buf[j] = '\0';
+
+	return j;   
+}
+
+void Gb2312_2_Unicode(unsigned short* dst, const char* src)
+{
+	MultiByteToWideChar(936, MB_PRECOMPOSED, src, 2, (LPWSTR)dst, 1);
+}
+
+void Unicode_2_UTF8(char* dst, unsigned short* src)
+{
+	char *pchar = (char *)src;
+
+	dst[0] = (0xE0 | ((pchar[1] & 0xF0) >> 4));
+	dst[1] = (0x80 | ((pchar[1] & 0x0F) << 2)) + ((pchar[0] & 0xC0) >> 6);
+	dst[2] = (0x80 | ( pchar[0] & 0x3F));
+}
+
+string UTF8ToTstring(const char *pData, size_t size)
+{
+	size_t n = MultiByteToWideChar(CP_UTF8, 0, pData, (int)size, NULL, 0);
+	WCHAR *pChar = new WCHAR[n+1];
+
+	n = MultiByteToWideChar(CP_UTF8, 0, pData, (int)size, pChar, n);
+	pChar[n]=0;
+
+	n = WideCharToMultiByte(936, 0, pChar, -1, 0, 0, 0, 0);
+	char *p = new char[n+1];
+
+	n = WideCharToMultiByte(936, 0, pChar, -1, p, (int)n, 0, 0);
+	string result(p);
+
+	delete []pChar;
+	delete []p;
+	return result;
+}
+
+string ConvertUTF8toGB2312(const char* pData, size_t size)
+{
+	size_t n = MultiByteToWideChar(CP_UTF8, 0, pData, (int)size, NULL, 0);
+	WCHAR* pChar = new WCHAR[n + 1];
+
+	n = MultiByteToWideChar(CP_UTF8, 0, pData, (int)size, pChar, n);
+	pChar[n] = 0;
+
+	n = WideCharToMultiByte(936, 0, pChar, -1, 0, 0, 0, 0);
+	char* p = new char[n + 1];
+
+	n = WideCharToMultiByte(936, 0, pChar, -1, p, (int)n, 0, 0);
+	string result(p);
+
+	delete[]pChar;
+	delete[]p;
+	return result;
+}
+
+string ConvertGB2312toUTF8(const char *pData)
+{
+	int len = MultiByteToWideChar(936, 0, pData, -1, NULL, 0);
+	wchar_t* wstr = new wchar_t[len+1];
+	memset(wstr, 0, len+1);
+	MultiByteToWideChar(936, 0, pData, -1, wstr, len);
+	len = WideCharToMultiByte(CP_UTF8, 0, wstr, -1, NULL, 0, NULL, NULL);
+	char* str = new char[len+1];
+	memset(str, 0, len+1);
+	WideCharToMultiByte(CP_UTF8, 0, wstr, -1, str, len, NULL, NULL);
+	if(wstr) delete[] wstr;
+	string strUtf8(str);
+	if(str) delete[] str;
+	return strUtf8;
+}
+
+wstring GB2312ToUnicode(const char *pData)
+{
+	wstring str;
+	int len = MultiByteToWideChar(936, 0, pData, -1, NULL, 0);  // 先取得转换后的UNICODE字符串所需的长度
+	if (len <= 0) return str;
+	wchar_t* pWstr = (wchar_t*)calloc(len + 1, sizeof(wchar_t));         // 分配缓冲区
+	MultiByteToWideChar(936, 0, pData, -1, pWstr, len);    // 开始转换
+	str = pWstr;
+	if (pWstr) free(pWstr);
+	return str;
+}
+
+string UnicodeToGB2312(TCHAR *pData)
+{
+	string str;
+	int len = WideCharToMultiByte(936, 0, pData, -1, NULL, 0, NULL, NULL);  // 先取得转换后的ANSI字符串所需的长度
+	if (len <= 0) return str;
+	char* pStr = (char*)calloc(len + 1, sizeof(char));                                             // 分配缓冲区
+	WideCharToMultiByte(936, 0, pData, -1, pStr, len, NULL, NULL);   // 开始转换
+	str = pStr;
+	if (pStr) free(pStr);
+	return str;
+}
+
+
+void UTF8toANSI(string &strUTF8)
+{
+	//获取转换为多字节后需要的缓冲区大小,创建多字节缓冲区  
+	UINT nLen = MultiByteToWideChar(CP_UTF8, NULL, strUTF8.c_str(), -1, NULL, NULL);
+	WCHAR *wszBuffer = new WCHAR[nLen + 1];
+	nLen = MultiByteToWideChar(CP_UTF8, NULL, strUTF8.c_str(), -1, wszBuffer, nLen);
+	wszBuffer[nLen] = 0;
+
+	nLen = WideCharToMultiByte(936, NULL, wszBuffer, -1, NULL, NULL, NULL, NULL);
+	char *szBuffer = new char[nLen + 1];
+	nLen = WideCharToMultiByte(936, NULL, wszBuffer, -1, szBuffer, nLen, NULL, NULL);
+	szBuffer[nLen] = 0;
+
+	strUTF8 = szBuffer;
+	//清理内存  
+	delete[]szBuffer;
+	delete[]wszBuffer;
+}
+
+string UnicodeToGB2312(const tstring& strSrc)
+{
+	return UnicodeToGB2312((LPTSTR)strSrc.c_str());
+}
+string UnicodeToGB2312(const CString& strSrc)
+{
+	tstring wstr = strSrc;
+	return UnicodeToGB2312((LPTSTR)wstr.c_str());
+}
+
+wstring UTF8ToUnicode(const char* szU8)
+{
+	wstring str;
+	if (szU8 == NULL)
+	{
+		return str;
+	}
+	//预转换,得到所需空间的大小;
+	int wcsLen = ::MultiByteToWideChar(CP_UTF8, NULL, szU8, strlen(szU8), NULL, 0);
+	if (wcsLen <= 0) return str;
+	//分配空间要给'\0'留个空间,MultiByteToWideChar不会给'\0'空间
+	wchar_t* pWStr = (wchar_t*)calloc(wcsLen + 1, sizeof(wchar_t));
+	//转换
+	::MultiByteToWideChar(CP_UTF8, NULL, szU8, strlen(szU8), pWStr, wcsLen);
+	pWStr[wcsLen] = L'\0';
+	str = pWStr;
+	if (pWStr) free(pWStr);
+	return str;
+}
+
+string UnicodeToUtf8(const wchar_t* unicode)
+{
+	string str;
+	int len;
+	len = WideCharToMultiByte(CP_UTF8, 0, unicode, -1, NULL, 0, NULL, NULL);
+	if (len <= 0) return str;
+	char *szUtf8 = (char*)calloc(len + 1, sizeof(char));
+	WideCharToMultiByte(CP_UTF8, 0, unicode, -1, szUtf8, len, NULL, NULL);
+	szUtf8[len] = '\0';
+	str = szUtf8; 
+	if (szUtf8) free(szUtf8);
+	return str;
+}
+tstring GB2312ToTstring(string str)
+{
+	tstring tstr=_T("");
+#ifdef _UNICODE
+	tstr=GB2312ToUnicode(str.c_str());
+#else
+	tstr=str;
+#endif
+	return tstr;
+}
+string	TstringToGB2312(tstring tstr)
+{
+	string str = "";
+#ifdef _UNICODE
+	str = UnicodeToGB2312(tstr);
+#else
+	str = pData;
+#endif
+	return str;
+}
+string TstringToUTF8(tstring tstr)
+{
+	string str = "";
+#ifdef _UNICODE
+	str = UnicodeToUtf8(tstr.c_str());
+#else
+	char* p=ConvertGB2312toUTF8(tstr.c_str());
+	str=*p;
+	delete[]p;
+#endif
+	return str;
+}
+
+tstring UTF8ToTstring(string str)
+{
+	tstring tstr = _T("");
+
+#ifdef _UNICODE
+	tstr = UTF8ToUnicode(str.c_str());
+#else
+	tstr = ConvertUTF8toGB2312(str.c_str(), str.length());
+#endif
+	return tstr;
+}
+
+bool TransToPriceFormat(const tstring& strSrc, tstring& strDes, double& dDes)
+{
+	vector<tstring> vctPrice;
+	if (!split(strSrc, _T("|"), vctPrice))
+		return false;
+
+	strDes.clear();
+	for (int i = 0; i < vctPrice.size(); i++)
+	{
+		if (vctPrice[i].length() == 0)
+			continue;
+
+		dDes += _tstof(vctPrice[i].c_str());
+
+		strDes.append(vctPrice[i]);
+
+		if (i != vctPrice.size()-1)
+		{
+			strDes.append(_T("+"));
+		}
+	}
+
+	return true;
+}
+
+int CalcWord(const char *ps, const size_t length)
+{
+	ASSERT(0 < length);
+	ASSERT(NULL != ps);
+	int nRealLen(0);
+	int nFlag(0);
+	while (nFlag <= length && 0 != ps[nRealLen])
+	{
+		if (IsChinese(ps[nRealLen]))
+		{
+			nRealLen++;
+			if (0 != ps[nRealLen])
+				nRealLen++;
+			else
+				break;
+		}
+		else
+			nRealLen++;
+
+		nFlag++;
+	}
+
+	return nRealLen;
+}
+
+void Int64DateToStr(const __int64& llDate, string& out)
+{
+	int nYear = llDate / 10000000000L;
+	int nMode = llDate % 10000000000L;
+
+	int nMon  = nMode / 100000000;
+	nMode    %= 100000000;
+
+	int nDay  = nMode / 1000000;
+	nMode    %= 1000000;
+
+	int nHour = nMode / 10000;
+	nMode    %= 10000;
+	
+	int nMin  = nMode / 100;
+	int nSec  = nMode % 100;
+
+	char buf[20];
+	memset(buf, 0, 20);
+	sprintf(buf, "%04d-%02d-%02d %02d:%02d:%02d", nYear,nMon,nDay,nHour,nMin,nSec);
+	
+	out = buf;
+}
+
+void Int64DateToYMDStr(const __int64& llDate, string& out)
+{
+	int nYear = llDate / 10000000000L;
+	int nMode = llDate % 10000000000L;
+
+	int nMon  = nMode / 100000000;
+	nMode    %= 100000000;
+
+	int nDay  = nMode / 1000000;
+	nMode    %= 1000000;
+
+	char buf[20];
+	memset(buf, 0, 20);
+	sprintf(buf, "%04d-%02d-%02d", nYear,nMon,nDay);
+	
+	out = buf;
+}
+
+void Int64DateToHMStr(const __int64& llDate, string& out)
+{
+	int nYear = llDate / 10000000000L;
+	int nMode = llDate % 10000000000L;
+
+	int nMon  = nMode / 100000000;
+	nMode    %= 100000000;
+
+	int nDay  = nMode / 1000000;
+	nMode    %= 1000000;
+
+	int nHour = nMode / 10000;
+	nMode    %= 10000;
+	
+	int nMin  = nMode / 100;
+
+	char buf[20];
+	memset(buf, 0, 20);
+	sprintf(buf, "%02d:%02d", nHour,nMin);
+	
+	out = buf;
+}
+
+unsigned char ToHex(unsigned char x)   
+{   
+	return  x > 9 ? x + 55 : x + 48;   
+}  
+
+unsigned char FromHex(unsigned char x)   
+{   
+	unsigned char y;  
+	if (x >= 'A' && x <= 'Z') y = x - 'A' + 10;  
+	else if (x >= 'a' && x <= 'z') y = x - 'a' + 10;  
+	else if (x >= '0' && x <= '9') y = x - '0';   
+	return y;  
+}  
+
+string UrlEncode(const string& str)  
+{  
+	string strTemp = "";  
+	size_t length = str.length();  
+	for (size_t i = 0; i < length; i++)  
+	{  
+		if (isalnum((unsigned char)str[i]) ||   
+			(str[i] == '-') ||  
+			(str[i] == '_') ||   
+			(str[i] == '.') ||   
+			(str[i] == '~'))  
+			strTemp += str[i];  
+		else if (str[i] == ' ')  
+			strTemp += "+";  
+		else  
+		{  
+			strTemp += '%';  
+			strTemp += ToHex((unsigned char)str[i] >> 4);  
+			strTemp += ToHex((unsigned char)str[i] % 16);  
+		}  
+	}  
+	return strTemp;  
+}  
+
+string UrlDecode(const string& str)  
+{  
+	string strTemp = "";  
+	size_t length = str.length();  
+	for (size_t i = 0; i < length; i++)  
+	{  
+		if (str[i] == '+') strTemp += ' ';  
+		else if (str[i] == '%')  
+		{   
+			unsigned char high = FromHex((unsigned char)str[++i]);  
+			unsigned char low = FromHex((unsigned char)str[++i]);  
+			strTemp += high*16 + low;  
+		}  
+		else strTemp += str[i];  
+	}  
+	return strTemp;  
+}  
+
+void DeleteDirectory(const CString &strPath)
+{
+	if (strPath.IsEmpty())
+		return;
+
+	CFileFind ff; 
+	BOOL bFound = ff.FindFile(strPath + _T("\\*"), 0); 
+	while(bFound) 
+	{ 
+		bFound  =  ff.FindNextFile(); 
+		if ((ff.GetFileName() == _T(".")) || (ff.GetFileName() == _T(".."))) 
+			continue; 
+
+		SetFileAttributes(ff.GetFilePath(), FILE_ATTRIBUTE_NORMAL); 
+		if (ff.IsDirectory())
+		{  
+			DeleteDirectory(ff.GetFilePath()); 
+			RemoveDirectory(ff.GetFilePath()); 
+		} 
+		else 
+		{ 
+			DeleteFile(ff.GetFilePath());  
+		} 
+	} 
+
+	ff.Close(); 
+	//RemoveDirectory(strPath); 
+} 
+
+void toUpper(char *szDestination, const char *szSource)
+{
+	if (szDestination == NULL || szSource == NULL || strlen(szSource) == 0)
+		return;
+	while (*szSource != 0)
+	{
+		if (*szSource >= 'a' && *szSource <= 'z')
+			*szDestination++ = 'A' + (*szSource++ - 'a');
+		else
+			*szDestination++ = *szSource++;
+	}
+	*szDestination = 0;
+}
+
+void toUpper(TCHAR *szDestination, const TCHAR *szSource)
+{
+	if (szDestination == NULL || szSource == NULL || _tcslen(szSource) == 0)
+		return;
+	while (*szSource != 0)
+	{
+		if (*szSource >= 'a' && *szSource <= 'z')
+			*szDestination++ = 'A' + (*szSource++ - 'a');
+		else
+			*szDestination++ = *szSource++;
+	}
+	*szDestination = 0;
+}
+
+void FormatPrice(char *szDes, const double dSource)
+{
+	sprintf(szDes, "%.9lf", dSource);
+	int i(0);
+	int nLen(strlen(szDes));
+	for (; i < nLen; i++)
+	{
+		if (szDes[i] == '.')
+			break;
+	}
+	for (int j = nLen - 1; j > i + 2; j--)
+	{
+		if (szDes[j] == '0')
+			szDes[j] = 0;
+		else
+			break;
+	}
+}
+
+bool CombinationVolRemark(string &strDes, const char *szVol, const char *szRemark)
+{
+	vector<string> vctVol;
+	vector<string> vctRemark;
+	bool bRet(true);
+	if (!split(szVol, "|", vctVol))
+		bRet = false;
+	if (!split(szRemark, "|",  vctRemark))
+		bRet = false;
+	if (vctVol.size() != vctRemark.size())
+		bRet = false;
+
+	if (!bRet)
+	{
+		if (!split(szVol, "+", vctVol))
+			bRet = false;
+		else
+			bRet = true;
+		if (!split(szRemark, "+",  vctRemark))
+			bRet = false;
+		else
+			bRet = true;
+
+		if (vctVol.size() != vctRemark.size())
+			bRet = false;
+	}
+
+	if (!bRet)
+		return bRet;
+
+	for (int i = 0; i < vctVol.size(); i++)
+	{
+		if (i != 0)
+			strDes.append("+");
+		if (vctVol[i].empty())
+			strDes.append("--");
+		else
+			strDes.append(vctVol[i]);
+
+		if (!vctRemark[i].empty())
+		{
+			strDes.append("(");
+			strDes.append(vctRemark[i]);
+			strDes.append(")");
+		}
+	}
+
+	return true;
+}
+
+string replace(const char *szContext, char oldChar, const char *szNew)
+{
+	int nLen = strlen(szContext) + 1;
+	if (szNew != NULL)
+		nLen += strlen(szNew);
+	char *pTemp = new char[nLen];
+	autoptr_arr<char> arrguard(pTemp);
+	memset(pTemp, 0, nLen);
+	char *pResult = pTemp;
+	while(*szContext != 0)
+	{
+		if (*szContext == oldChar)
+		{
+			if (szNew != NULL)
+			{
+				while (*szNew!= 0)
+				{
+					*pTemp++ = *szNew++;
+				}
+			}
+		}
+		else
+		{
+			*pTemp++ = *szContext;
+		}
+		szContext++;
+	}
+	return string(pResult);
+}
+
+bool CombinationQuoteData(string &strDes, const char *szVol, const char *szRemark/* = NULL*/
+	, const char *szDanger/* = NULL*/, const char *szOCO/* = NULL*/, const char *szPACK/* = NULL*/)
+{
+	if (szVol == NULL)
+		return false;
+
+	vector<const char*> vctData;
+	vctData.push_back(szVol);
+
+	if (szDanger != NULL)
+	{
+		vctData.push_back(szDanger);
+	}
+	if (szOCO != NULL)
+	{
+		vctData.push_back(szOCO);
+	}
+	if (szPACK != NULL)
+	{
+		vctData.push_back(szPACK);
+	}
+	if (szRemark != NULL && strlen(szRemark) > 0 && strcmp(szRemark, "--") != 0)
+	{
+		vctData.push_back(szRemark);
+	}	
+	const char* arrSeparators[2] = {"|", "+"};
+	bool bMulti(false);
+	int nIdx(0);
+	for (int i = 0; i < 2; i++)
+	{
+		if (strstr(szVol, arrSeparators[i]) != NULL)
+		{
+			nIdx = i;	
+			bMulti = true;
+			break;
+		}
+	}
+	if (bMulti)
+	{
+		vector<vector<string>> vctSplit;
+		for (int i = 0; i < vctData.size(); i++)
+		{
+			vector<string> vct;
+			if (!split(vctData[i], arrSeparators[nIdx], vct))
+			{
+				return false;
+			}
+			vctSplit.push_back(vct);
+		}
+
+		int nCount(vctSplit[0].size());
+
+		for (int i = 1; i < vctSplit.size(); i++)
+		{
+			if (nCount != vctSplit[i].size())
+				return false;
+		}
+
+		for (int i = 0; i < nCount; i++)
+		{
+			if (i != 0)
+				strDes.append("+");
+			
+			if (strlen((vctSplit[0])[i].c_str()) == 0)
+				strDes.append("--");
+			else
+			{
+				strDes.append((vctSplit[0])[i]);
+			}
+
+			string strTemp;
+
+			for (int j = 1; j < vctSplit.size(); j++)
+			{
+				if (strlen((vctSplit[j])[i].c_str()) != 0)
+				{
+					strTemp.append((vctSplit[j])[i]);
+					strTemp.append(",");
+				}
+			}
+			if (!strTemp.empty())
+			{
+				if (strTemp[strTemp.size() - 1] == ',')
+				{
+					strTemp = string(strTemp.c_str(), strTemp.size() - 1);
+				}
+			}
+
+			if (!strTemp.empty())
+			{
+				strDes.append("(");
+				strDes.append(strTemp);
+				strDes.append(")");
+			}
+		}
+	}
+	else
+	{
+		if (strlen(szVol) == 0)
+		{
+			strDes.append("--");
+		}
+		else
+		{
+			strDes.append(szVol);
+		}
+		
+		string strTemp;
+
+		for (int i = 1; i < vctData.size(); i++)
+		{
+			if (strlen(vctData[i]) != 0)
+			{
+				strTemp.append(vctData[i]);
+				strTemp.append(",");
+			}
+		}
+		if (!strTemp.empty())
+		{
+			if (strTemp[strTemp.size() - 1] == ',')
+			{
+				strTemp = string(strTemp.c_str(), strTemp.size() - 1);
+			}
+		}
+		if (!strTemp.empty())
+		{
+			strDes.append("(");
+			strDes.append(strTemp);
+			strDes.append(")");
+		}
+	}
+
+	return true;
+}
+
+__int64 StringToInt64(const TCHAR *szSource)
+{
+	__int64 ret(0);
+	if (_tcslen(szSource) == 0)
+		return ret;
+
+	const TCHAR *pTemp = szSource + _tcslen(szSource) - 1;
+	__int64 nRight(1);
+	bool bNegative(false);
+	if ('-' == szSource[0])
+		bNegative = true;
+	do
+	{		
+		if (*pTemp >= '0' && *pTemp <= '9')
+		{
+			ret += nRight * (0 + (*pTemp - '0'));
+			nRight *= 10;
+		}
+	} 
+	while(pTemp-- != szSource);
+	if (bNegative)
+		ret = -ret;
+	return ret;
+}
+
+void SafeCopyData(TCHAR dest[], int destSize, TCHAR* src)
+{
+	int srcSize = _tcslen(src);
+	if (srcSize == 0)
+	{
+		return;
+	}
+	if (srcSize > destSize)
+		memcpy(dest, src, destSize);
+	else
+		_tcscpy(dest, src);
+}
+
+void SafeCopyData(TCHAR dest[], int destSize, tstring str)
+{
+	int srcSize = str.length();
+	if (srcSize == 0)
+	{
+		return;
+	}
+	if (srcSize > destSize)
+		memcpy(dest, str.c_str(), destSize);
+	else
+		_tcscpy(dest, str.c_str());
+}
+
+tstring GetRequestByKey(const tstring& tstrKey, const tstring& tstrReuest)
+{
+	string strKey = UnicodeToGB2312(tstrKey);
+	string strReuest = UnicodeToGB2312(tstrReuest);
+	try
+	{
+		smatch result; 
+		if (regex_search(strReuest.cbegin(), strReuest.cend(), result, regex(strKey + "=(.*?)&")))
+		{
+			  return GB2312ToUnicode(result[1].str().c_str());
+		}
+		else if (regex_search(strReuest.cbegin(), strReuest.cend(), result, regex(strKey + "=(.*)")))
+		{
+			return GB2312ToUnicode(result[1].str().c_str());
+		}
+		else 
+		{           
+			return tstring();
+		}
+	}
+	catch (...)
+	{
+		return tstring();
+	}
+	return tstring();
+}
+
+void GetKeysByUrl(const tstring & strUrl, vector<tstring> & vctKey)
+{
+	vector<tstring> vctSearch;
+	split(strUrl, _T("?"), vctSearch);
+	if (vctSearch.size() != 2 && vctSearch.size() != 1)
+	{
+		return;
+	}
+	tstring strTemp;
+	if (vctSearch.size() == 1)
+	{
+		strTemp = vctSearch[0];
+	}
+	else if (vctSearch.size() == 2)
+	{
+		strTemp = vctSearch[1];
+	}
+	vctSearch.clear();
+	split(strTemp, _T("&"), vctSearch);
+	if (vctSearch.size() <= 0)
+	{
+		return;
+	}
+	for (int i = 0; i < vctSearch.size(); i++)
+	{
+		strTemp = vctSearch[i];
+		vector<tstring> vct;
+		split(strTemp, _T("="), vct);
+		if (vct.size() == 2)
+		{
+			vctKey.push_back(vct[0]);
+		}
+	}
+}
+
+__int64 GetCharNumber(TCHAR* szText, size_t n)
+{
+	__int64  nDest;
+	if (n == 0)
+	{
+		return -1;
+	}
+	for (nDest = 0; n--; szText++)
+	{
+		if (*szText < '0' || *szText > '9')
+		{
+			continue; //继续获取下一个字符  
+		}
+		/*
+		1、当前字符值 *line的ascii码,减去字符0的ascii码,得出个位数字
+		2、原计算的value值 乘以10,向上提升一位
+		3、二者相加得到新的十进制数值
+		*/
+		nDest = nDest * 10 + (*szText - '0');
+	}
+
+	if (nDest < 0)
+	{
+		return -1;
+	}
+	else
+	{
+		return nDest;
+	}
+}
+
+
+tstring ANSIToUnicode(const string& str)
+{
+	int  len = 0;
+	len = str.length();
+	int  unicodeLen = ::MultiByteToWideChar(936,
+		0,
+		str.c_str(),
+		-1,
+		NULL,
+		0);
+	wchar_t *  pUnicode;
+	pUnicode = new  wchar_t[unicodeLen + 1];
+	memset(pUnicode, 0, (unicodeLen + 1)*sizeof(wchar_t));
+	::MultiByteToWideChar(936,
+		0,
+		str.c_str(),
+		-1,
+		(LPWSTR)pUnicode,
+		unicodeLen);
+	tstring  rt;
+	rt = (wchar_t*)pUnicode;
+	delete  pUnicode;
+
+	return  rt;
+}
+
+CString  AddNumberSeparate(CString strSrc)
+{
+	auto IsNumberFunc = [=](CString str)
+	{
+		int nCount = 0;
+		for (int i = 0; i < str.GetLength(); i++)
+		{
+			if (i == 0)
+			{
+				if (str.GetAt(i) == '-')
+				{
+					continue;
+				}
+			}
+			if (!((str.GetAt(i) >= '0' && str.GetAt(i) <= '9') || str.GetAt(i) == '.'))
+			{
+				return FALSE;
+			}
+			if (str.GetAt(i) == '.')
+			{
+				nCount++;
+			}
+		}
+		if (nCount > 1)
+		{
+			return FALSE;
+		}
+		return TRUE;
+	};
+
+	CString str(strSrc);
+	if (IsNumberFunc(str))
+	{
+		int nPos = 0;
+		nPos = str.Find(_T("."), nPos);
+		vector<int> vcteparatePos;
+		if (nPos == -1)
+		{
+			for (int i = str.GetLength() - 3; i > 0; i--)
+			{
+				if ((str.GetLength() - i) % 3 == 0)
+				{
+					if (!(i == 1 && str.GetAt(0) == '-'))
+					{
+						vcteparatePos.push_back(i);
+					}
+				}
+			}
+		}
+		else
+		{
+			for (int i = nPos - 3; i > 0; i--)
+			{
+				if ((nPos - i) % 3 == 0)
+				{
+					if (!(i == 1 && str.GetAt(0) == '-'))
+					{
+						vcteparatePos.push_back(i);
+					}
+				}
+			}
+		}
+		for (int i = 0; i < vcteparatePos.size(); i++)
+		{
+			str.Insert(vcteparatePos[i], ',');
+		}
+	}
+	return str;
+}
+
+bool RegexStdMatch(string src, string regular)
+{
+	regex pattern(regular.c_str());
+	if (!regex_match(src, pattern))
+	{
+		return false;
+	}
+	return true;
+}
+
+bool RegexStdMatch(tstring src, tstring regular)
+{
+	char* pre = setlocale(LC_ALL, "");
+	setlocale(LC_ALL, "chs");
+	std::wregex pattern(regular.c_str());
+	if (!regex_match(src, pattern))
+	{
+		return false;
+	}
+	return true;
+}
+
+CString FormatNumberString(CString strData)
+{
+	TCHAR szTemp[32] = { 0 };
+	_stprintf(szTemp, _T("%0.4lf"), _tstof(strData));
+	CString str = szTemp;
+	str.TrimRight(_T("0"));
+	if (str.Find(_T(".")) == (str.GetLength() - 1))
+		str.TrimRight(_T("."));
+	return str;
+}
+
+tstring   replace_all(tstring&   str, const   tstring&   old_value, const   tstring&   new_value)
+{
+	while (true)
+	{
+		tstring::size_type   pos(0);
+		if ((pos = str.find(old_value)) != tstring::npos)
+			str.replace(pos, old_value.length(), new_value);
+		else   break;
+	}
+	return   str;
+}
+
+tstring FormatInt32Value(int nValue)
+{
+	TCHAR szTemp[64] = { 0 };
+	_stprintf(szTemp, _T("%d"), nValue);
+	return tstring(szTemp);
+}
+
+string FormatInt32Value2(int nValue)
+{
+	char szTemp[64] = { 0 };
+	sprintf(szTemp, "%d", nValue);
+	return string(szTemp);
+}
+
+
+tstring FormatInt64Value(__int64 nValue)
+{
+	TCHAR szTemp[64] = { 0 };
+	_stprintf(szTemp, _T("%lld"), nValue);
+	return tstring(szTemp);
+}
+
+tstring FormatFloatValue(double fValue)
+{
+	TCHAR szTemp[32] = { 0 };
+	_stprintf(szTemp, _T("%0.3lf"), fValue);
+	CString str = szTemp;
+	str.TrimRight(_T("0"));
+	if (str.Find(_T(".")) == (str.GetLength() - 1))
+		str.TrimRight(_T("."));
+	return tstring(str);
+}
+
+string FormatFloatValue2(double fValue)
+{
+	char szTemp[64] = { 0 };
+	sprintf(szTemp, "%0.3lf", fValue);
+	return  string(szTemp);
+}
+
+
+CString GetAppPath()
+{
+	CString strRetun = _T("");
+
+#ifdef _UNICODE
+	TCHAR szBuff[MAX_PATH];
+	HMODULE module = GetModuleHandle(0);
+	GetModuleFileName(module, szBuff, sizeof(szBuff));
+	strRetun.Format(_T("%s"), szBuff);
+
+#else
+	HMODULE module = GetModuleHandle(0);
+	CHAR szBuff[MAX_PATH];
+	GetModuleFileName(module, szBuff, sizeof(szBuff));
+	strRetun.Format(_T("%s"), szBuff);
+#endif 
+
+	int pos = strRetun.ReverseFind(_T('\\'));
+
+	if (pos != -1)
+	{
+		strRetun = strRetun.Left(pos);
+	}
+	return strRetun;
+}

+ 173 - 0
MFCApplication1/BaseUtility.h

@@ -0,0 +1,173 @@
+#pragma once
+#include <iomanip>
+#include <sstream>
+#include <vector>
+
+using namespace std;
+
+#ifndef _UNICODE
+#define tstring std::string
+#else
+#define tstring std::wstring
+#endif
+
+#ifndef _UNICODE
+#define tstringstream std::stringstream
+#else
+#define tstringstream std::wstringstream
+#endif
+
+
+template<class T = char>
+class autoptr
+{
+public:
+	autoptr(T *buf) : m_buf(buf) {}
+	~autoptr() {
+		if (m_buf)
+		{
+			delete m_buf;
+			m_buf = NULL;
+		}
+	}
+private:
+	T *m_buf;
+};
+
+template<class T = char>
+class autoptr_arr
+{
+public:
+	autoptr_arr(T *buf) : m_buf(buf) {}
+	~autoptr_arr() {
+		delete[]m_buf;
+	}
+private:
+	T *m_buf;
+};
+
+bool IsLeap(int year);
+bool IsWeekEnd(int year, int month, int day);
+bool Nextday(int& year, int& month, int& day);
+
+void Full2Half(wchar_t* str);
+bool split(const tstring& src, tstring delimit,vector<tstring> &v, tstring null_subst=_T(""));
+bool split(const string& src, string delimit, vector<string> &v, string null_subst = "");
+vector<tstring> splitEx(const tstring& src, tstring separate_character);
+vector<string> splitEx(const string& src, string separate_character);
+int GB2312_2_UTF8(char* buf, int buf_len, const char* src, int src_len);
+void Gb2312_2_Unicode(unsigned short* dst, const char* src);
+void Unicode_2_UTF8(char* dst, unsigned short* src);
+string ConvertUTF8toGB2312(const char *pData, size_t size);
+string ConvertGB2312toUTF8(const char *pData);
+bool TransToPriceFormat(const tstring& strSrc, tstring& strDes, double& dDes);
+
+wstring GB2312ToUnicode(const char *pData);
+wstring UTF8ToUnicode(const char* szU8);
+void UTF8toANSI(string &strUTF8);
+string UnicodeToUtf8(const wchar_t* unicode);
+string UnicodeToGB2312(TCHAR* pData);
+string UnicodeToGB2312(const tstring& strSrc);
+string UnicodeToGB2312(const CString& strSrc);
+tstring GB2312ToTstring(string str);
+string	TstringToGB2312(tstring tstr);
+string TstringToUTF8(tstring tstr);
+tstring UTF8ToTstring(string str);
+
+inline bool IsChinese(unsigned char c) { return ((c>=0xa1)&&(c<=0xfe)); }
+int CalcWord(const char *ps, const size_t length);
+
+void Int64DateToStr(const __int64& llDate, string& out);
+void Int64DateToYMDStr(const __int64& llDate, string& out);
+void Int64DateToHMStr(const __int64& llDate, string& out);
+
+void GetSubStr(TCHAR *szDestination, const TCHAR *szSource, const int nWidth, HDC hDC);
+
+bool IsNumAndPoint(const CString& strText);
+
+unsigned char ToHex(unsigned char x);
+unsigned char FromHex(unsigned char x);
+string UrlEncode(const string& str);
+string UrlDecode(const string& str);
+void DeleteDirectory(const CString &strPath);
+
+void toUpper(char *szDestination, const char *szSource);
+void toUpper(TCHAR *szDestination, const TCHAR *szSource);
+
+void FormatPrice(char *szDes, const double dSource);  // 格式化价格 小数部分至少两位
+
+bool CombinationVolRemark(string &strDes, const char *szVol, const char *szRemark);
+
+bool CombinationQuoteData(string &strDes, const char *szVol, const char *szRemark = NULL
+	, const char *szDanger = NULL, const char *szOCO = NULL, const char *szPACK = NULL);
+
+string replace(const char *szContext, char oldChar, const char *szNew);
+
+__int64 StringToInt64(const TCHAR *szSourse);
+
+void SafeCopyData(TCHAR dest[], int destSize, TCHAR* src);
+void SafeCopyData(TCHAR dest[], int destSize, tstring str);
+
+tstring GetRequestByKey(const tstring& strKey,const tstring& strReuest);  // 解析URL中的参数
+
+void GetKeysByUrl(const tstring & strUrl, vector<tstring> & vctKey);
+
+__int64 GetCharNumber(TCHAR* szText, size_t n);	// 获取字符串所有的数据			
+
+CString  AddNumberSeparate(CString strSrc);
+
+bool RegexStdMatch(string src, string regular);  // std 正则表达式校验
+bool RegexStdMatch(tstring src, tstring regular);
+tstring   replace_all(tstring&   str, const   tstring&   old_value, const   tstring&   new_value);
+
+template<typename T>
+tstring  tostring(T t, int bit = 4)
+{
+	tstring result;
+	wstringstream ss;
+	ss << fixed << setprecision(bit) << t;
+	ss >> result;
+	CString strTemp = result.c_str();
+
+	int nIndex = strTemp.Find(_T("."));
+	if (nIndex != -1)
+	{
+		strTemp.TrimRight(_T("0"));
+		if (nIndex == strTemp.GetLength() - 1)
+		{
+			strTemp.TrimRight(_T("."));
+		}
+	}
+	if (strTemp == _T("-0"))
+		strTemp = _T("0");
+	return tstring(strTemp);
+}
+tstring ANSIToUnicode(const string& str);
+
+CString FormatNumberString(CString strData);
+
+#define CLOSE_IMAGE(pImage) if (pImage)\
+	{\
+		delete pImage;\
+		pImage = NULL;\
+	}\
+
+
+#define CLOSE_ICON(hIcon) if (hIcon)\
+	{\
+		::DestroyIcon(hIcon);\
+		hIcon = NULL; \
+	}\
+	
+//格式化手机号码
+#define FormatPhoneNumber(strPhone)\
+if (strPhone.GetLength() > 5)\
+{\
+	strPhone = strPhone.Mid(0, 3) + "******" + strPhone.Mid(strPhone.GetLength() - 2, 2);\
+}
+string FormatInt32Value2(int nValue);
+tstring FormatInt32Value(int nValue);
+tstring FormatInt64Value(__int64 nValue);
+tstring FormatFloatValue(double fValue);
+string FormatFloatValue2(double fValue);
+CString GetAppPath();

+ 320 - 0
MFCApplication1/CvxText.cpp

@@ -0,0 +1,320 @@
+#include "pch.h"
+#include "CvxText.h"
+
+using namespace std;
+using namespace cv;
+
+void GetStringSize(HDC hDC, const char* str, int* w, int* h)
+{
+	SIZE size;
+	GetTextExtentPoint32A(hDC, str, strlen(str), &size);
+	if (w != 0) *w = size.cx;
+	if (h != 0) *h = size.cy;
+}
+
+void putTextZH(cv::Mat &dst, cv::Size & rSize, const char* str, Point org, Scalar color, int fontSize, const char* fn, bool italic, bool underline)
+{
+	CV_Assert(dst.data != 0 && (dst.channels() == 1 || dst.channels() == 3));
+
+	int x, y, r, b;
+	if (org.x > dst.cols || org.y > dst.rows) return;
+	x = org.x < 0 ? -org.x : 0;
+	y = org.y < 0 ? -org.y : 0;
+
+	LOGFONTA lf;
+	lf.lfHeight = -fontSize;
+	lf.lfWidth = 0;
+	lf.lfEscapement = 0;
+	lf.lfOrientation = 0;
+	lf.lfWeight = 5;
+	lf.lfItalic = italic;   //斜体
+	lf.lfUnderline = underline; //下划线
+	lf.lfStrikeOut = 0;
+	lf.lfCharSet = DEFAULT_CHARSET;
+	lf.lfOutPrecision = 0;
+	lf.lfClipPrecision = 0;
+	lf.lfQuality = PROOF_QUALITY;
+	lf.lfPitchAndFamily = 0;
+	strcpy_s(lf.lfFaceName, fn);
+
+	HFONT hf = CreateFontIndirectA(&lf);
+	HDC hDC = CreateCompatibleDC(0);
+	HFONT hOldFont = (HFONT)SelectObject(hDC, hf);
+
+	int strBaseW = 0, strBaseH = 0;
+	int singleRow = 0;
+	char buf[1 << 12];
+	strcpy_s(buf, str);
+	char *bufT[1 << 12];  // 这个用于分隔字符串后剩余的字符,可能会超出。
+	//处理多行
+	{
+		int nnh = 0;
+		int cw, ch;
+
+		const char* ln = strtok_s(buf, "\n", bufT);
+		while (ln != 0)
+		{
+			GetStringSize(hDC, ln, &cw, &ch);
+			strBaseW = max(strBaseW, cw);
+			strBaseH = max(strBaseH, ch);
+
+			ln = strtok_s(0, "\n", bufT);
+			nnh++;
+		}
+		singleRow = strBaseH;
+		strBaseH *= nnh;
+
+	}
+
+	rSize.width = strBaseW;
+	rSize.height = strBaseH;
+
+	if (org.x + strBaseW < 0 || org.y + strBaseH < 0)
+	{
+		SelectObject(hDC, hOldFont);
+		DeleteObject(hf);
+		DeleteObject(hDC);
+		return;
+	}
+
+	r = org.x + strBaseW > dst.cols ? dst.cols - org.x - 1 : strBaseW - 1;
+	b = org.y + strBaseH > dst.rows ? dst.rows - org.y - 1 : strBaseH - 1;
+	org.x = org.x < 0 ? 0 : org.x;
+	org.y = org.y < 0 ? 0 : org.y;
+
+	BITMAPINFO bmp = { 0 };
+	BITMAPINFOHEADER& bih = bmp.bmiHeader;
+	int strDrawLineStep = strBaseW * 3 % 4 == 0 ? strBaseW * 3 : (strBaseW * 3 + 4 - ((strBaseW * 3) % 4));
+
+	bih.biSize = sizeof(BITMAPINFOHEADER);
+	bih.biWidth = strBaseW;
+	bih.biHeight = strBaseH;
+	bih.biPlanes = 1;
+	bih.biBitCount = 24;
+	bih.biCompression = BI_RGB;
+	bih.biSizeImage = strBaseH * strDrawLineStep;
+	bih.biClrUsed = 0;
+	bih.biClrImportant = 0;
+
+	void* pDibData = 0;
+	HBITMAP hBmp = CreateDIBSection(hDC, &bmp, DIB_RGB_COLORS, &pDibData, 0, 0);
+
+	CV_Assert(pDibData != 0);
+	HBITMAP hOldBmp = (HBITMAP)SelectObject(hDC, hBmp);
+
+	//color.val[2], color.val[1], color.val[0]
+	SetTextColor(hDC, RGB(255, 255, 255));
+	SetBkColor(hDC, 0);
+	//SetStretchBltMode(hDC, COLORONCOLOR);
+
+	strcpy_s(buf, str);
+	const char* ln = strtok_s(buf, "\n", bufT);
+	int outTextY = 0;
+	while (ln != 0)
+	{
+		TextOutA(hDC, 0, outTextY, ln, strlen(ln));
+		outTextY += singleRow;
+		ln = strtok_s(0, "\n", bufT);
+	}
+	uchar* dstData = (uchar*)dst.data;
+	int dstStep = dst.step / sizeof(dstData[0]);
+	unsigned char* pImg = (unsigned char*)dst.data + org.x * dst.channels() + org.y * dstStep;
+	unsigned char* pStr = (unsigned char*)pDibData + x * 3;
+	for (int tty = y; tty <= b; ++tty)
+	{
+		unsigned char* subImg = pImg + (tty - y) * dstStep;
+		unsigned char* subStr = pStr + (strBaseH - tty - 1) * strDrawLineStep;
+		for (int ttx = x; ttx <= r; ++ttx)
+		{
+			for (int n = 0; n < dst.channels(); ++n) {
+				double vtxt = subStr[n] / 255.0;
+				int cvv = vtxt * color.val[n] + (1 - vtxt) * subImg[n];
+				subImg[n] = cvv > 255 ? 255 : (cvv < 0 ? 0 : cvv);
+			}
+
+			subStr += 3;
+			subImg += dst.channels();
+		}
+	}
+
+	SelectObject(hDC, hOldBmp);
+	SelectObject(hDC, hOldFont);
+	DeleteObject(hf);
+	DeleteObject(hBmp);
+	DeleteDC(hDC);
+}
+
+/////////////////////////////  数据收集卡  /////////////////////////////////////// 
+
+
+// 获取字符串的画布上的宽度
+int getLineStrWidth(string str, int fontSize, int ttBoxW,int tiSl, int backPix) {
+	int iw = str.length()*fontSize*0.5;
+	iw += ttBoxW;
+	iw += tiSl;
+	iw += backPix;
+	iw += fontSize * 1.5; // 题号的宽度 最多不超过1.5个字体宽度 56.
+	
+	return iw;
+}
+
+// 转码 utf-8 2 ansi  
+static void UTF82ANSI(LPCSTR lpBuff, int nLen, char* pData, int iMaxLen)
+{
+	ZeroMemory(pData, sizeof(char)*iMaxLen);
+	int nCont = MultiByteToWideChar(CP_UTF8, 0, lpBuff, nLen, NULL, 0);
+	WCHAR* szTemp = new WCHAR[nCont + 1];
+	ZeroMemory(szTemp, sizeof(WCHAR)*(nCont + 1));
+	MultiByteToWideChar(CP_UTF8, 0, lpBuff, nLen, szTemp, nCont);
+	//获取缓冲区大小,并申请空间,缓冲区大小事按字节计算的   
+	int len = WideCharToMultiByte(CP_ACP, 0, szTemp, nCont, NULL, 0, NULL, NULL);
+	if (len < iMaxLen) {
+		WideCharToMultiByte(CP_ACP, 0, szTemp, nCont, pData, len, NULL, NULL);
+	}
+	else {
+		char* buffer = new char[len + 1];
+		//宽字节编码转换成多字节编码   
+		WideCharToMultiByte(CP_ACP, 0, szTemp, nCont, buffer, len, NULL, NULL);
+		buffer[len] = '\0';
+		//删除缓冲区并返回值 
+		strncpy(pData, buffer, iMaxLen - 1);
+		delete[] buffer;
+		buffer = NULL;
+	}
+	delete[]szTemp;
+	szTemp = NULL;
+}
+
+// 二进制码生成获取
+void createBinString(Mat & img, int pageNum, int ptw, int pth, cv::Point ptStart) {
+	vector<int> vecBinStr; vecBinStr.resize(12);
+	for (size_t i = 11; i > 0; i--) {
+		int ys = pageNum % 2;
+		vecBinStr[i] = ys;
+		pageNum = pageNum / 2;
+	}
+
+	vector<cv::Rect> vecBoxPages; vecBoxPages.resize(12);
+	int ptPgW = ptw / 2; int ptPgH = pth / 2;
+	for (int j = 0; j < 3; j++) {
+		int _startY = ptStart.y + 15 + 50 * j;
+		for (int i = 0; i < 4; i++) {
+			int _startX = ptStart.x + 18 + i * 72;
+			vecBoxPages.push_back(cv::Rect(_startX, _startY, ptPgW, ptPgH));
+			if (vecBinStr[j * 4 + i])
+				rectangle(img, vecBoxPages[vecBoxPages.size() - 1], cv::Scalar(0), -1);
+			else
+				rectangle(img, vecBoxPages[vecBoxPages.size() - 1], cv::Scalar(200, 200, 200), 2, 8, 0);
+		}
+	}
+	return;
+}
+
+int dataCollectionPaper(int cols, int index,int fontSize, int lineGrayPix, bool engShow, std::vector<string> & vecLines) {
+	/* 这里要做一些栏数 和 vecLines的对应值确认 */
+	if (2 == cols && 14*2 == vecLines.size())
+		; // ok 
+	if (3 == cols && 14*3 == vecLines.size())
+		; // ok 
+	if (4 == cols && 14*4 == vecLines.size())
+		; // ok 
+
+	// 生成画布图像 
+	cv::Mat img(cv::Size(1654, 2344), CV_8UC3, cv::Scalar(255, 255, 255));
+	int ptw = 80; int pth = 40;
+	cv::Size fSize(0, 0);
+	int leftPos = 100, rightPos = 1450;
+	int topPos = 90;
+	int fontW = rightPos - leftPos + ptw;
+	vector<cv::Rect> vecPts = {
+		cv::Rect(100,90,ptw,pth),
+		cv::Rect(580,90,ptw,pth),
+		cv::Rect(1450,90,ptw,pth),
+		cv::Rect(100,2176,ptw,pth),
+		cv::Rect(1450,2176,ptw,pth),
+	};
+
+
+	// 画定位点
+	for (size_t i = 0; i < vecPts.size(); i++) 
+	{
+		rectangle(img, vecPts[i], cv::Scalar(0, 0, 0), -1);
+	}
+
+	// 画示例框
+	topPos += pth; topPos += 30;
+	rectangle(img, cv::Rect(leftPos, topPos, fontW, 200), cv::Scalar(0, 0, 0), 2, 8, 0);
+
+	// 画页码框
+	cv::Rect boxPageNumber(leftPos + fontW - 300, topPos, 300, 200);
+	rectangle(img, boxPageNumber, cv::Scalar(0, 0, 0), 2, 8, 0);
+
+	// 生成二进制码流
+	/* 二进制码流的坐标在下面函数里面实现,需要用书写获取 */
+	createBinString(img, index, ptw, pth, cv::Point(boxPageNumber.x, boxPageNumber.y));
+	string strPageNumInfo = "关联ID: " + to_string(index);
+	putTextZH(img, fSize, strPageNumInfo.c_str(), cv::Point(boxPageNumber.x + 100, boxPageNumber.y + 50 * 2 + 20 + 15 + 15 + 15), Scalar(0), 20, "宋体");
+
+	// 画警示信息
+	string strMesInfo = "1、请在每题下方的横线上书写本题的内容!\
+						\n\n2、题号不需要书写,标点符号需要原样书写。☆\
+						\n\n3、如果本题书写有误,进行了涂抹修改等操作,请将题号前矩形框用任意笔进行填涂!☆☆\n";
+	putTextZH(img, fSize, strMesInfo.c_str(), cv::Point(leftPos + 20, topPos + 20), Scalar(0), 25, "宋体");
+	int lineTop1 = topPos + 20 + fSize.height + 20;
+	cv::line(img, cv::Point(leftPos, lineTop1), cv::Point(rightPos + ptw - 300, topPos + 20 + fSize.height + 20), Scalar(0), 2, 8, 0);
+
+	// 正确示例
+	string strEgInfo = "正\n确\n示\n例";
+	putTextZH(img, fSize, strEgInfo.c_str(), cv::Point(leftPos + 20, topPos + 20 + fSize.height + 20 + 3), Scalar(0), 20, "宋体");
+	cv::line(img, cv::Point(leftPos + 20 + fSize.width + 10, lineTop1), cv::Point(leftPos + 20 + fSize.width + 10, topPos + 200), Scalar(0, 0, 0), 2, 8, 0);
+
+	// 贴图区域
+	/* 暂不实现 */
+
+	topPos += 200;
+
+	// 文字区域 
+	static int maxLineNum = 14;	// 最大行数14
+	static int colWidth = fontW / cols; // 单栏的宽度
+	static int ttBoxWidth = 30;  // 填涂框的边长
+	static int tiSl = 10; // 题号和题干见的距离
+	static int lineDis = 20;	// 两行之间的距离
+	fSize.width = 0; fSize.height = 0;
+	for (int col = 0; col < cols; col++) 
+	{ // 逐栏画题
+		int colTopPos = topPos;
+		int colLeftPos = leftPos + col * colWidth;
+		for (size_t i = 0; i < maxLineNum; i++)
+		{
+			colTopPos += lineDis;
+			int lineLen = ttBoxWidth + tiSl;
+			// 画填涂框 30*30 大小
+			rectangle(img, cv::Rect(colLeftPos, colTopPos, ttBoxWidth, ttBoxWidth), cv::Scalar(0), 1, 8, 0);
+			int iQNum = i+1 + col * maxLineNum;
+			string strStinfo = to_string(iQNum); strStinfo += ".";
+			putTextZH(img, fSize, strStinfo.c_str(), cv::Point(colLeftPos + ttBoxWidth + tiSl, colTopPos), Scalar(0, 0, 0), fontSize, "宋体"); // 跟填涂框保持10px距离
+			lineLen += fSize.width;
+			strStinfo.clear(); 
+			size_t vecIndex = i + col * maxLineNum;
+			string strTgInfo = vecLines[vecIndex];
+			if (!engShow)
+				; /*  移除词性   */
+			char szTemp[2048];
+			memset(szTemp, 0, sizeof(char)*(2048));
+			UTF82ANSI(strTgInfo.c_str(), strTgInfo.length(), szTemp, 2048);
+			strTgInfo = szTemp;
+			putTextZH(img, fSize, strTgInfo.c_str(), cv::Point(colLeftPos + ttBoxWidth + tiSl + fSize.width , colTopPos), Scalar(0, 0, 0), fontSize, "宋体"); // 跟填涂框保持10px距离
+			lineLen += fSize.width;
+			colTopPos = colTopPos + fSize.height * 3.5; //两行之间两倍的距离用于书写
+			
+			line(img, cv::Point(colLeftPos+30, colTopPos), cv::Point(colLeftPos + lineLen, colTopPos), Scalar(lineGrayPix, lineGrayPix, lineGrayPix), 1, 8, 0);
+		}
+	}
+	cv::imwrite(R"(G:\英译汉手写识别\数据收集\template-2.png)", img);
+	cv::namedWindow("fuck", 1);
+	cv::imshow("fuck", img);
+	cv::waitKey(0);
+
+	return 0;
+}
+

+ 44 - 0
MFCApplication1/CvxText.h

@@ -0,0 +1,44 @@
+#pragma once
+#ifndef PUTTEXT_H_
+#define PUTTEXT_H_
+
+#include <string>
+#include <opencv2/opencv.hpp>
+using namespace std;
+
+void GetStringSize(HDC hDC, const char* str, int* w, int* h);
+void putTextZH(cv::Mat &dst, cv::Size & rSize, const char* str, cv::Point org, cv::Scalar color, int fontSize,
+	const char *fn = "Arial", bool italic = false, bool underline = false);
+
+
+/// 数据收集卡 功能样式设计
+
+
+/********************************************************
+	*  @function :  获取字符串的画布上的宽度
+	*  @brief    :  brief
+	*  @input    :  str:	字符串
+	*  @input    :  fontSize:	信息区域字体大小
+	*  @input    :  ttBoxW:		填涂框宽度
+	*  @input    :  tiSl:		题号和题干的距离
+	*  @input	 :  backPix:	每行的预留空间
+	*  @return   :
+	*  @author   :  qqm  2022/08/31 19:42
+*********************************************************/
+int getLineStrWidth(string str, int fontSize, int ttBoxW, int tiSl, int backPix);
+
+/******************************************************** 
+    *  @function :  生成一张数据收集卡
+    *  @brief    :  brief 
+    *  @input    :  cols:	栏数
+	*  @input    :  index:	关联ID
+	*  @input    :  fontSize:	信息区域字体大小
+	*  @input    :  linGrayPix:	横线的灰度值
+	*  @input    :  vecLines:	本张数据行
+	*  @input	 :  engShow:	是否显示词性
+    *  @return   : 
+    *  @author   :  qqm  2022/08/31 19:42
+*********************************************************/
+int dataCollectionPaper(int cols, int index, int fontSize, int lineGrayPix, bool engShow, std::vector<std::string> & vecLines);
+
+#endif // PUTTEXT_H_

BIN
MFCApplication1/MFCApplication1.aps


+ 107 - 0
MFCApplication1/MFCApplication1.cpp

@@ -0,0 +1,107 @@
+
+// MFCApplication1.cpp: 定义应用程序的类行为。
+//
+
+#include "pch.h"
+#include "framework.h"
+#include "MFCApplication1.h"
+#include "MFCApplication1Dlg.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+
+// CMFCApplication1App
+
+BEGIN_MESSAGE_MAP(CMFCApplication1App, CWinApp)
+	ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
+END_MESSAGE_MAP()
+
+
+// CMFCApplication1App 构造
+
+CMFCApplication1App::CMFCApplication1App()
+{
+	// 支持重新启动管理器
+	m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
+
+	// TODO: 在此处添加构造代码,
+	// 将所有重要的初始化放置在 InitInstance 中
+}
+
+
+// 唯一的 CMFCApplication1App 对象
+
+CMFCApplication1App theApp;
+
+
+// CMFCApplication1App 初始化
+
+BOOL CMFCApplication1App::InitInstance()
+{
+	// 如果一个运行在 Windows XP 上的应用程序清单指定要
+	// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
+	//则需要 InitCommonControlsEx()。  否则,将无法创建窗口。
+	INITCOMMONCONTROLSEX InitCtrls;
+	InitCtrls.dwSize = sizeof(InitCtrls);
+	// 将它设置为包括所有要在应用程序中使用的
+	// 公共控件类。
+	InitCtrls.dwICC = ICC_WIN95_CLASSES;
+	InitCommonControlsEx(&InitCtrls);
+
+	CWinApp::InitInstance();
+
+
+	AfxEnableControlContainer();
+
+	// 创建 shell 管理器,以防对话框包含
+	// 任何 shell 树视图控件或 shell 列表视图控件。
+	CShellManager *pShellManager = new CShellManager;
+
+	// 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
+	CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
+
+	// 标准初始化
+	// 如果未使用这些功能并希望减小
+	// 最终可执行文件的大小,则应移除下列
+	// 不需要的特定初始化例程
+	// 更改用于存储设置的注册表项
+	// TODO: 应适当修改该字符串,
+	// 例如修改为公司或组织名
+	SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
+
+	CMFCApplication1Dlg dlg;
+	m_pMainWnd = &dlg;
+	INT_PTR nResponse = dlg.DoModal();
+	if (nResponse == IDOK)
+	{
+		// TODO: 在此放置处理何时用
+		//  “确定”来关闭对话框的代码
+	}
+	else if (nResponse == IDCANCEL)
+	{
+		// TODO: 在此放置处理何时用
+		//  “取消”来关闭对话框的代码
+	}
+	else if (nResponse == -1)
+	{
+		TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
+		TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
+	}
+
+	// 删除上面创建的 shell 管理器。
+	if (pShellManager != nullptr)
+	{
+		delete pShellManager;
+	}
+
+#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
+	ControlBarCleanUp();
+#endif
+
+	// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
+	//  而不是启动应用程序的消息泵。
+	return FALSE;
+}
+

+ 32 - 0
MFCApplication1/MFCApplication1.h

@@ -0,0 +1,32 @@
+
+// MFCApplication1.h: PROJECT_NAME 应用程序的主头文件
+//
+
+#pragma once
+
+#ifndef __AFXWIN_H__
+	#error "include 'pch.h' before including this file for PCH"
+#endif
+
+#include "resource.h"		// 主符号
+
+
+// CMFCApplication1App:
+// 有关此类的实现,请参阅 MFCApplication1.cpp
+//
+
+class CMFCApplication1App : public CWinApp
+{
+public:
+	CMFCApplication1App();
+
+// 重写
+public:
+	virtual BOOL InitInstance();
+
+// 实现
+
+	DECLARE_MESSAGE_MAP()
+};
+
+extern CMFCApplication1App theApp;

BIN
MFCApplication1/MFCApplication1.rc


+ 227 - 0
MFCApplication1/MFCApplication1.vcxproj

@@ -0,0 +1,227 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|Win32">
+      <Configuration>Debug</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|Win32">
+      <Configuration>Release</Configuration>
+      <Platform>Win32</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <VCProjectVersion>15.0</VCProjectVersion>
+    <ProjectGuid>{30460CBA-2FF0-4739-A482-3AA5D8203AB1}</ProjectGuid>
+    <Keyword>MFCProj</Keyword>
+    <RootNamespace>MFCApplication1</RootNamespace>
+    <WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>true</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <PlatformToolset>v141</PlatformToolset>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>Unicode</CharacterSet>
+    <UseOfMfc>Dynamic</UseOfMfc>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Label="Shared">
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <LinkIncremental>true</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <LinkIncremental>false</LinkIncremental>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+      <AdditionalIncludeDirectories>..\thridparty\opencv\Include;%(AdditionalIncludeDirectories);./libpdf</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <AdditionalLibraryDirectories>..\thridparty\opencv\Lib;.\libpdf\debug</AdditionalLibraryDirectories>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>Disabled</Optimization>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+      <AdditionalIncludeDirectories>..\thridparty\opencv\Include;%(AdditionalIncludeDirectories);./libpdf</AdditionalIncludeDirectories>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <AdditionalLibraryDirectories>..\thridparty\opencv\Lib;.\libpdf\release</AdditionalLibraryDirectories>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>true</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
+    </ClCompile>
+    <Link>
+      <SubSystem>Windows</SubSystem>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+    </Link>
+    <Midl>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+      <ValidateAllParameters>true</ValidateAllParameters>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </Midl>
+    <ResourceCompile>
+      <Culture>0x0804</Culture>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClInclude Include="BaseUtility.h" />
+    <ClInclude Include="CvxText.h" />
+    <ClInclude Include="framework.h" />
+    <ClInclude Include="MFCApplication1.h" />
+    <ClInclude Include="MFCApplication1Dlg.h" />
+    <ClInclude Include="pch.h" />
+    <ClInclude Include="Resource.h" />
+    <ClInclude Include="targetver.h" />
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="BaseUtility.cpp" />
+    <ClCompile Include="CvxText.cpp" />
+    <ClCompile Include="MFCApplication1.cpp" />
+    <ClCompile Include="MFCApplication1Dlg.cpp" />
+    <ClCompile Include="pch.cpp">
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="MFCApplication1.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\MFCApplication1.rc2" />
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\MFCApplication1.ico" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>

+ 75 - 0
MFCApplication1/MFCApplication1.vcxproj.filters

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup>
+    <Filter Include="源文件">
+      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
+      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
+    </Filter>
+    <Filter Include="头文件">
+      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
+      <Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
+    </Filter>
+    <Filter Include="资源文件">
+      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
+      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
+    </Filter>
+  </ItemGroup>
+  <ItemGroup>
+    <ClInclude Include="MFCApplication1.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="MFCApplication1Dlg.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="framework.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="targetver.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="Resource.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="pch.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="CvxText.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+    <ClInclude Include="BaseUtility.h">
+      <Filter>头文件</Filter>
+    </ClInclude>
+  </ItemGroup>
+  <ItemGroup>
+    <ClCompile Include="MFCApplication1.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="MFCApplication1Dlg.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="pch.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="CvxText.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+    <ClCompile Include="BaseUtility.cpp">
+      <Filter>源文件</Filter>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="MFCApplication1.rc">
+      <Filter>资源文件</Filter>
+    </ResourceCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="res\MFCApplication1.rc2">
+      <Filter>资源文件</Filter>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <Image Include="res\MFCApplication1.ico">
+      <Filter>资源文件</Filter>
+    </Image>
+  </ItemGroup>
+</Project>

+ 244 - 0
MFCApplication1/MFCApplication1Dlg.cpp

@@ -0,0 +1,244 @@
+
+// MFCApplication1Dlg.cpp: 实现文件
+//
+
+#include "pch.h"
+#include "framework.h"
+#include "MFCApplication1.h"
+#include "MFCApplication1Dlg.h"
+#include "afxdialogex.h"
+#include "CvxText.h"
+#include "BaseUtility.h"
+#include "libpdf.h"
+
+#ifdef _DEBUG
+#pragma comment(lib, "libpdfd.lib")
+#else
+#pragma comment(lib, "libpdf.lib")
+#endif
+
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#endif
+
+#define SAFETY_CLOSE_HANDLE( handle )									\
+	if( NULL != handle )													\
+{																		\
+	CloseHandle( handle );												\
+	handle = NULL;														\
+}
+
+#define SAFETY_EXIT_THREAD( hThread, Timeout )							\
+	if( NULL != hThread )													\
+{																		\
+	if( WaitForSingleObject( hThread, Timeout ) == WAIT_TIMEOUT )		\
+	TerminateThread( hThread, -1 );									\
+	CloseHandle( hThread );												\
+	hThread = NULL;														\
+}
+
+
+// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
+
+class CAboutDlg : public CDialogEx
+{
+public:
+	CAboutDlg();
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_ABOUTBOX };
+#endif
+
+	protected:
+	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV 支持
+
+// 实现
+protected:
+	DECLARE_MESSAGE_MAP()
+};
+
+CAboutDlg::CAboutDlg() : CDialogEx(IDD_ABOUTBOX)
+{
+}
+
+void CAboutDlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+}
+
+BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
+END_MESSAGE_MAP()
+
+
+// CMFCApplication1Dlg 对话框
+
+
+HANDLE _threadProcess = NULL;
+DWORD WINAPI ProcessThread(void *param)
+{
+	CMFCApplication1Dlg* pWnd = (CMFCApplication1Dlg*)theApp.m_pMainWnd;
+	//1.读txt列表
+	//2.生成图像及图像对应的模板json
+	//3.图像合并成pdf
+
+	//通知发送消息到窗口
+	CString strErrorMsg = L"";
+	strErrorMsg.Format(L"PDF生成完成!\r\n");
+	SendMessage(pWnd->m_hWnd, WM_SHOWINFO, (WPARAM)strErrorMsg.GetBuffer(), 1);
+	strErrorMsg.ReleaseBuffer();
+	return 0L;
+}
+
+CMFCApplication1Dlg::CMFCApplication1Dlg(CWnd* pParent /*=nullptr*/)
+	: CDialogEx(IDD_MFCAPPLICATION1_DIALOG, pParent)
+	, m_strMsg(_T(""))
+{
+	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
+}
+
+void CMFCApplication1Dlg::DoDataExchange(CDataExchange* pDX)
+{
+	CDialogEx::DoDataExchange(pDX);
+	DDX_Text(pDX, IDC_EDIT_MSG, m_strMsg);
+}
+
+BEGIN_MESSAGE_MAP(CMFCApplication1Dlg, CDialogEx)
+	ON_WM_SYSCOMMAND()
+	ON_WM_PAINT()
+	ON_WM_QUERYDRAGICON()
+	ON_BN_CLICKED(IDOK, &CMFCApplication1Dlg::OnBnClickedOk)
+	ON_MESSAGE(WM_SHOWINFO, OnShowInfo)
+	ON_BN_CLICKED(IDCANCEL, &CMFCApplication1Dlg::OnBnClickedCancel)
+END_MESSAGE_MAP()
+
+
+// CMFCApplication1Dlg 消息处理程序
+
+BOOL CMFCApplication1Dlg::OnInitDialog()
+{
+	CDialogEx::OnInitDialog();
+
+	// 将“关于...”菜单项添加到系统菜单中。
+
+	// IDM_ABOUTBOX 必须在系统命令范围内。
+	ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
+	ASSERT(IDM_ABOUTBOX < 0xF000);
+
+	CMenu* pSysMenu = GetSystemMenu(FALSE);
+	if (pSysMenu != nullptr)
+	{
+		BOOL bNameValid;
+		CString strAboutMenu;
+		bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
+		ASSERT(bNameValid);
+		if (!strAboutMenu.IsEmpty())
+		{
+			pSysMenu->AppendMenu(MF_SEPARATOR);
+			pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
+		}
+	}
+
+	// 设置此对话框的图标。  当应用程序主窗口不是对话框时,框架将自动
+	//  执行此操作
+	SetIcon(m_hIcon, TRUE);			// 设置大图标
+	SetIcon(m_hIcon, FALSE);		// 设置小图标
+
+	// TODO: 在此添加额外的初始化代码
+
+	return TRUE;  // 除非将焦点设置到控件,否则返回 TRUE
+}
+
+void CMFCApplication1Dlg::OnSysCommand(UINT nID, LPARAM lParam)
+{
+	if ((nID & 0xFFF0) == IDM_ABOUTBOX)
+	{
+		CAboutDlg dlgAbout;
+		dlgAbout.DoModal();
+	}
+	else
+	{
+		CDialogEx::OnSysCommand(nID, lParam);
+	}
+}
+
+// 如果向对话框添加最小化按钮,则需要下面的代码
+//  来绘制该图标。  对于使用文档/视图模型的 MFC 应用程序,
+//  这将由框架自动完成。
+
+void CMFCApplication1Dlg::OnPaint()
+{
+	if (IsIconic())
+	{
+		CPaintDC dc(this); // 用于绘制的设备上下文
+
+		SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
+
+		// 使图标在工作区矩形中居中
+		int cxIcon = GetSystemMetrics(SM_CXICON);
+		int cyIcon = GetSystemMetrics(SM_CYICON);
+		CRect rect;
+		GetClientRect(&rect);
+		int x = (rect.Width() - cxIcon + 1) / 2;
+		int y = (rect.Height() - cyIcon + 1) / 2;
+
+		// 绘制图标
+		dc.DrawIcon(x, y, m_hIcon);
+	}
+	else
+	{
+		CDialogEx::OnPaint();
+	}
+}
+
+//当用户拖动最小化窗口时系统调用此函数取得光标
+//显示。
+HCURSOR CMFCApplication1Dlg::OnQueryDragIcon()
+{
+	return static_cast<HCURSOR>(m_hIcon);
+}
+
+void CMFCApplication1Dlg::OnBnClickedOk()
+{
+	GetDlgItem(IDOK)->EnableWindow(FALSE);
+
+	SAFETY_EXIT_THREAD(_threadProcess, 100);
+	_threadProcess = CreateThread(NULL, 0, ProcessThread, NULL, 0, NULL);
+
+	std::vector<string> vecLines;
+	for (size_t i = 0; i < 100; i++)
+	{
+		vecLines.push_back(ConvertGB2312toUTF8("寿1111111112222333"));
+	}
+	dataCollectionPaper(1,1000, 10, 100, false, vecLines);
+	//CDialogEx::OnOK();
+}
+
+void CMFCApplication1Dlg::UpdateMsg(CString strMsg)
+{
+	m_strMsg += strMsg;
+	UpdateData(FALSE);
+}
+
+
+LRESULT CMFCApplication1Dlg::OnShowInfo(WPARAM  wParam, LPARAM  lParam)
+{
+	char* p = (char*)wParam;
+	CString str;
+	str.Format(_T("%s"), p);
+	m_strMsg += str;
+	UpdateData(FALSE);
+
+	if (lParam == 1)
+	{
+		GetDlgItem(IDOK)->EnableWindow(TRUE);
+	}
+	return 0;
+}
+
+void CMFCApplication1Dlg::OnBnClickedCancel()
+{
+	SAFETY_EXIT_THREAD(_threadProcess, 100);
+	CDialogEx::OnCancel();
+}

+ 41 - 0
MFCApplication1/MFCApplication1Dlg.h

@@ -0,0 +1,41 @@
+
+// MFCApplication1Dlg.h: 头文件
+//
+
+#pragma once
+
+#define WM_SHOWINFO (WM_USER+0x1)
+// CMFCApplication1Dlg 对话框
+class CMFCApplication1Dlg : public CDialogEx
+{
+// 构造
+public:
+	CMFCApplication1Dlg(CWnd* pParent = nullptr);	// 标准构造函数
+
+// 对话框数据
+#ifdef AFX_DESIGN_TIME
+	enum { IDD = IDD_MFCAPPLICATION1_DIALOG };
+#endif
+
+	protected:
+	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV 支持
+
+
+// 实现
+protected:
+	HICON m_hIcon;
+
+	// 生成的消息映射函数
+	virtual BOOL OnInitDialog();
+	afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
+	afx_msg void OnPaint();
+	afx_msg HCURSOR OnQueryDragIcon();
+	afx_msg LRESULT OnShowInfo(WPARAM  wParam, LPARAM  lParam);
+	DECLARE_MESSAGE_MAP()
+public:
+	afx_msg void OnBnClickedOk();
+	CString m_strMsg;
+
+	void UpdateMsg(CString strMsg);
+	afx_msg void OnBnClickedCancel();
+};

+ 49 - 0
MFCApplication1/framework.h

@@ -0,0 +1,49 @@
+#pragma once
+
+#ifndef VC_EXTRALEAN
+#define VC_EXTRALEAN            // 从 Windows 头中排除极少使用的资料
+#endif
+
+#include "targetver.h"
+
+#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // 某些 CString 构造函数将是显式的
+
+// 关闭 MFC 的一些常见且经常可放心忽略的隐藏警告消息
+#define _AFX_ALL_WARNINGS
+
+#include <afxwin.h>         // MFC 核心组件和标准组件
+#include <afxext.h>         // MFC 扩展
+
+
+#include <afxdisp.h>        // MFC 自动化类
+
+
+
+#ifndef _AFX_NO_OLE_SUPPORT
+#include <afxdtctl.h>           // MFC 对 Internet Explorer 4 公共控件的支持
+#endif
+#ifndef _AFX_NO_AFXCMN_SUPPORT
+#include <afxcmn.h>             // MFC 对 Windows 公共控件的支持
+#endif // _AFX_NO_AFXCMN_SUPPORT
+
+#include <afxcontrolbars.h>     // MFC 支持功能区和控制条
+
+
+
+
+
+
+
+
+
+#ifdef _UNICODE
+#if defined _M_IX86
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#elif defined _M_X64
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#else
+#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
+#endif
+#endif
+
+

BIN
MFCApplication1/libpdf/debug/libpdfd.dll


BIN
MFCApplication1/libpdf/debug/libpdfd.lib


BIN
MFCApplication1/libpdf/debug/libpng16d.dll


BIN
MFCApplication1/libpdf/debug/zlibd1.dll


+ 21 - 0
MFCApplication1/libpdf/libpdf.h

@@ -0,0 +1,21 @@
+#ifndef __LIBPDF_H__
+#define __LIBPDF_H__
+
+#include <string>
+#include <vector>
+
+using namespace std;
+#ifdef LIBPDF_EXPORTS
+#define LIBPDF _declspec(dllexport)
+#else
+#define LIBPDF _declspec(dllimport)
+#endif
+
+/************************************
+	功能:多张图片合并成一个pdf文件
+	参数说明:vecImage:需要合并的图片列表  strPdfName:合并后的pdf文件
+	返回值:0:成功 非0:失败 错误值参考:https://github.com/libharu/libharu/wiki/Error-handling
+************************************/
+LIBPDF int PdfNewFromImage(vector<string> vecImage, string strPdfName);
+
+#endif

BIN
MFCApplication1/libpdf/release/libpdf.dll


BIN
MFCApplication1/libpdf/release/libpdf.exp


BIN
MFCApplication1/libpdf/release/libpdf.lib


BIN
MFCApplication1/libpdf/release/libpdf.pdb


BIN
MFCApplication1/libpdf/release/libpng16.dll


BIN
MFCApplication1/libpdf/release/zlib1.dll


+ 5 - 0
MFCApplication1/pch.cpp

@@ -0,0 +1,5 @@
+// pch.cpp: 与预编译标头对应的源文件
+
+#include "pch.h"
+
+// 当使用预编译的头时,需要使用此源文件,编译才能成功。

+ 13 - 0
MFCApplication1/pch.h

@@ -0,0 +1,13 @@
+// pch.h: 这是预编译标头文件。
+// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
+// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
+// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
+// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
+
+#ifndef PCH_H
+#define PCH_H
+#define _CRT_SECURE_NO_WARNINGS
+// 添加要在此处预编译的标头
+#include "framework.h"
+
+#endif //PCH_H

BIN
MFCApplication1/res/MFCApplication1.ico


BIN
MFCApplication1/res/MFCApplication1.rc2


+ 25 - 0
MFCApplication1/resource.h

@@ -0,0 +1,25 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Visual C++ 生成的包含文件。
+// 供 MFCApplication1.rc 使用
+//
+#define IDM_ABOUTBOX                    0x0010
+#define IDD_ABOUTBOX                    100
+#define IDS_ABOUTBOX                    101
+#define IDD_MFCAPPLICATION1_DIALOG      102
+#define IDR_MAINFRAME                   128
+#define IDC_BTN_TXT                     1000
+#define IDC_EDIT_TXT                    1001
+#define IDC_EDIT_PDF                    1002
+#define IDC_BTN_PDF                     1003
+#define IDC_EDIT_MSG                    1005
+
+// Next default values for new objects
+// 
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        130
+#define _APS_NEXT_COMMAND_VALUE         32771
+#define _APS_NEXT_CONTROL_VALUE         1006
+#define _APS_NEXT_SYMED_VALUE           101
+#endif
+#endif

+ 8 - 0
MFCApplication1/targetver.h

@@ -0,0 +1,8 @@
+#pragma once
+
+// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
+
+// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
+// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
+
+#include <SDKDDKVer.h>

+ 43 - 0
pdf.sln

@@ -0,0 +1,43 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.28307.2017
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MFCApplication1", "MFCApplication1\MFCApplication1.vcxproj", "{30460CBA-2FF0-4739-A482-3AA5D8203AB1}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
+		MinSizeRel|Win32 = MinSizeRel|Win32
+		MinSizeRel|x64 = MinSizeRel|x64
+		Release|Win32 = Release|Win32
+		Release|x64 = Release|x64
+		RelWithDebInfo|Win32 = RelWithDebInfo|Win32
+		RelWithDebInfo|x64 = RelWithDebInfo|x64
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.Debug|Win32.ActiveCfg = Debug|Win32
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.Debug|Win32.Build.0 = Debug|Win32
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.Debug|x64.ActiveCfg = Debug|x64
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.Debug|x64.Build.0 = Debug|x64
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.MinSizeRel|Win32.ActiveCfg = Release|Win32
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.MinSizeRel|Win32.Build.0 = Release|Win32
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.MinSizeRel|x64.ActiveCfg = Release|x64
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.MinSizeRel|x64.Build.0 = Release|x64
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.Release|Win32.ActiveCfg = Release|Win32
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.Release|Win32.Build.0 = Release|Win32
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.Release|x64.ActiveCfg = Release|x64
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.Release|x64.Build.0 = Release|x64
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.RelWithDebInfo|Win32.ActiveCfg = Release|Win32
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.RelWithDebInfo|Win32.Build.0 = Release|Win32
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.RelWithDebInfo|x64.ActiveCfg = Release|x64
+		{30460CBA-2FF0-4739-A482-3AA5D8203AB1}.RelWithDebInfo|x64.Build.0 = Release|x64
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {6EC4AE0E-BEE8-3500-BB66-528AF3AF966E}
+	EndGlobalSection
+EndGlobal