Browse Source

开始对接电子秤

张洋 4 years ago
parent
commit
7a73d530a7

BIN
bin/Win32/Debug/zhipuzi_pos_windows/dump/2021-11-30-17-47-09.dmp


+ 1 - 1
bin/Win32/Debug/zhipuzi_pos_windows/skin/setting_dianzicheng.xml

@@ -5,7 +5,7 @@
 	<HorizontalLayout height="44">
 		<Label text="电子秤型号" width="260"/>
 		<Combo name="setting_dianzicheng_xinghao" padding="0,9,0,0" width="300" height="26" tooltip="请点击这里选择您的电子秤型号" normalimage="file='Setting_Combox_Normal.png' corner='2,2,24,2'" hotimage="file='Setting_Combox_Hover.png' corner='2,2,24,2'" pushedimage="Setting_Combox_Click.png' corner='2,2,24,2'" textpadding="10,1,1,1" >
-			<ListLabelElement text="大华ACS-30Ab" selected="true" />
+			<ListLabelElement text="大华ACS系列" selected="true" />
 		</Combo>
 	</HorizontalLayout>
 	

+ 6 - 1
bin/Win32/Debug/zhipuzi_pos_windows/skin/setting_page.xml

@@ -3,13 +3,14 @@
 	<SettingPage name="setting_page" bkcolor="#FFEFF6EE">
 		<HorizontalLayout>
 			<HorizontalLayout width="250" padding="20,20,20,0">
-				<VerticalLayout height="600" bkcolor="#FFFFFFFF" childpadding="15" inset="20,20,20,0">
+				<VerticalLayout height="800" bkcolor="#FFFFFFFF" childpadding="15" inset="20,20,20,0">
 					<Option name="setting_waimai_order_switch" selected="true" text="外卖订单设置" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
 					<Option name="setting_diannei_order_switch" text="店内订单设置" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
 					<Option name="setting_printer_switch" text="小票打印设置" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
 					<Option name="setting_biaoqian_printer_switch" text="标签打印设置" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
 					<Option name="setting_chufang_printer_switch" text="厨房打印设置" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
 					<Option name="setting_dianzicheng_switch" text="电子秤设置" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
+					<Option name="setting_tiaomacheng_switch" text="条码秤设置" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
 					<Option name="setting_xianshi_switch" text="显示设置" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
 					<Option name="setting_system_switch" text="系统设置" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
 					<Option name="setting_system_about" text="关于" group="setting_switch" align="center" height="38" normalimage="file='Btn_White.png' corner='5,5,5,5'" selectedimage="file='Btn_Green_Click.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" hottextcolor="#CC1010" selectedtextcolor="#FFFFFFFF" />
@@ -44,6 +45,10 @@
 				</VerticalLayout>
 				
 				<VerticalLayout bkcolor="#FFFFFFFF" padding="0,20,20,20" inset="15,15,15,15">
+					<Include source="setting_tiaomacheng.xml" />
+				</VerticalLayout>
+				
+				<VerticalLayout bkcolor="#FFFFFFFF" padding="0,20,20,20" inset="15,15,15,15">
 					<Include source="setting_xianshi.xml" />
 				</VerticalLayout>
 

File diff suppressed because it is too large
+ 40 - 0
bin/Win32/Debug/zhipuzi_pos_windows/skin/setting_tiaomacheng.xml


+ 5 - 10
bin/Win32/Debug/zhipuzi_pos_windows/skin/youhui_show_dlg.xml

@@ -1,10 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<Window size="502,600" caption="0,0,0,36" roundcorner="4,4" >
+<Window size="502,500" caption="0,0,0,36" roundcorner="4,4" >
 	<Font id="0" name="微软雅黑" size="22" />
 	
-	<VerticalLayout bkcolor="#FFFFFFFF" bordersize="1" bordercolor="#FFE8E8E8">
-		<HorizontalLayout height="50" inset="10,2,10,0">
-			<Label name="memo_dlg_title" text="优惠明细" align="center" valign="center" padding="0,20,0,0" font="0"/>
+	<VerticalLayout bkimage="shoukuan_bkg.png" >
+		<HorizontalLayout name="shoukuan_title_bkg" height="44" bkcolor="0xFF3CB371">
+			<Label name="memo_dlg_title" text="优惠明细" height="44" align="center" valign="center" padding="0,0,0,0" textcolor="#FFFFFFFF" font="2"/>
+			<Button name="closebtn" keyboard="false" padding="0,13,15,0" width="16" height="16" normalimage="file='close_normal.png'" hotimage="file='close_hover.png'" pushedimage="file='close_normal.png'"/>
 		</HorizontalLayout>
 		
 		<VerticalLayout padding="0,20,0,0">
@@ -58,11 +59,5 @@
 				<Label name="moling_value" text="0元" width="230" align="left"></Label>
 			</HorizontalLayout>
 		</VerticalLayout>
-		
-		<HorizontalLayout height="56" valign="center" padding="0,30,0,20">
-			<Control />
-			<Button name="quit" align="center" width="100" height="45" padding="0,20,0,0" text="关闭" normalimage="file='Btn_White.png' corner='5,5,5,5'" hotimage="file='Btn_White_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_White_Click.png' corner='5,5,5,5'" />
-			<Control />
-		</HorizontalLayout>
 	</VerticalLayout>
 </Window>

+ 69 - 0
zhipuzi_pos_windows/helper/CLewaimaiString.cpp

@@ -309,6 +309,28 @@ std::string CLewaimaiString::ANSIToUTF8(const std::string str)
     return sUtf8;
 }
 
+std::string CLewaimaiString::UnicodeToGB2312(const wstring& wstr)
+{
+	std::string result;
+
+	int n = WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, 0, 0, 0, 0);
+	result.resize(n);
+	::WideCharToMultiByte(CP_ACP, 0, wstr.c_str(), -1, (char*)result.c_str(), n, 0, 0);
+
+	return result;
+}
+
+std::wstring CLewaimaiString::GB2312ToUnicode(const string& src)
+{
+	std::wstring result;
+
+	int n = MultiByteToWideChar(CP_ACP, 0, src.c_str(), -1, NULL, 0);
+	result.resize(n);
+	::MultiByteToWideChar(CP_ACP, 0, src.c_str(), -1, (LPWSTR)result.c_str(), result.length());
+
+	return result;
+}
+
 std::string CLewaimaiString::DoubleToString(const double value, unsigned int precisionAfterPoint)
 {
     char str[256];
@@ -496,4 +518,51 @@ std::string CLewaimaiString::GetPathDir(std::string filePath)
 		dirPath.erase(p);
 	}
 	return dirPath;
+}
+
+std::string CLewaimaiString::BuZifuLeft(std::string old, int num, const char zifu)
+{
+	return std::string(num, zifu) + old;
+}
+
+std::string CLewaimaiString::GetQuweima(std::wstring input)
+{
+	//先转换成GB2312,区位码都是相对于GB2312的
+	std::string gb_hanzi = CLewaimaiString::UnicodeToGB2312(input);
+
+	std::string result = "";
+
+	for (size_t i = 0; i < gb_hanzi.length() - 1; )
+	{
+		byte* cur = (byte*)(gb_hanzi.c_str() + i);
+		if (*cur >= 0 && *cur <= 127)
+		{
+			//正常的asicc码,字符串或者数字
+			int front = (short)(*cur - '\0');
+
+			front -= 32;
+
+			if (front < 10)
+			{
+				result += "030" + to_string(front);
+			}
+			else
+			{
+				result += "03" + to_string(front);
+			}
+
+			i++;
+		}
+		else
+		{
+			int front = (short)(cur[0] - '\0');//将字节数组的第一位转换成short类型,这里(short)code[0]也是可以的
+			int back = (short)(cur[1] - '\0');//将字节数组的第二位转换成short类型
+			result += to_string(front - 160) + to_string(back - 160);//计算并返回区位码
+
+			i++;
+			i++;
+		}
+	}
+
+	return result;
 }

+ 9 - 0
zhipuzi_pos_windows/helper/CLewaimaiString.h

@@ -31,6 +31,9 @@ public:
 
 	static std::string ANSIToUTF8(const std::string str);
 
+	static std::string UnicodeToGB2312(const wstring& wstr);
+	static std::wstring GB2312ToUnicode(const string& src);
+
 	static std::string DoubleToString(const double value, unsigned int precisionAfterPoint);
 
 	static std::string UrlEncode(const std::string& str);
@@ -56,4 +59,10 @@ public:
 
 	//得到文件路径的目录
 	static std::string GetPathDir(std::string filePath);
+
+	//在字符串old的左边,补num个字符 zifu
+	static std::string BuZifuLeft(std::string old, int num, const char zifu);
+
+	//用于条码标签秤,把Unicode格式的字符串(可以中英文混写)转换成用于条码秤的区位码
+	static std::string GetQuweima(std::wstring input);
 };

+ 220 - 4
zhipuzi_pos_windows/page/CSettingPageUI.cpp

@@ -7,6 +7,8 @@
 #include "../helper/CComHelper.h"
 #include "../tool/CChengzhongWorker.h"
 
+#include <boost/array.hpp>
+
 CSettingPageUI::CSettingPageUI()
 {
 
@@ -415,7 +417,7 @@ void CSettingPageUI::InitShow()
 	{
 		com->SetInternVisible(true);
 		com->SelectItem(0, false, false);
-		com->SetText(L"大华ACS-30Ab");
+		com->SetText(L"大华ACS系列");
 	}
 
 	//串口下拉框默认选中
@@ -496,6 +498,74 @@ void CSettingPageUI::InitShow()
 		com->SetText(L"38400");
 	}
 
+	//标签秤设置
+	com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_tiaomacheng_geshi")));
+	std::string setting_tiaomacheng_geshi = CSetting::GetParam("setting_tiaomacheng_geshi");
+
+	if (setting_tiaomacheng_geshi == "1")
+	{
+		com->SetInternVisible(true);
+		com->SelectItem(0, false, false);
+		com->SetText(L"13位【FWWWWWWEEEEEC】");
+	}
+	else if (setting_tiaomacheng_geshi == "2")
+	{
+		com->SetInternVisible(true);
+		com->SelectItem(1, false, false);
+		com->SetText(L"13位【FWWWWWWNNNNNC】");
+	}
+	else if (setting_tiaomacheng_geshi == "3")
+	{
+		com->SetInternVisible(true);
+		com->SelectItem(2, false, false);
+		com->SetText(L"13位【FFWWWWWEEEEEC】");
+	}
+	else if (setting_tiaomacheng_geshi == "4")
+	{
+		com->SetInternVisible(true);
+		com->SelectItem(3, false, false);
+		com->SetText(L"13位【FFWWWWWNNNNNC】");
+	}
+	else if (setting_tiaomacheng_geshi == "5")
+	{
+		com->SetInternVisible(true);
+		com->SelectItem(4, false, false);
+		com->SetText(L"18位【FWWWWWWEEEEENNNNNC】");
+	}
+	else if (setting_tiaomacheng_geshi == "6")
+	{
+		com->SetInternVisible(true);
+		com->SelectItem(5, false, false);
+		com->SetText(L"18位【FWWWWWWNNNNNEEEEEC】");
+	}
+	else if (setting_tiaomacheng_geshi == "7")
+	{
+		com->SetInternVisible(true);
+		com->SelectItem(6, false, false);
+		com->SetText(L"18位【FFWWWWWEEEEENNNNNC】");
+	}
+	else if (setting_tiaomacheng_geshi == "8")
+	{
+		com->SetInternVisible(true);
+		com->SelectItem(6, false, false);
+		com->SetText(L"18位【FFWWWWWNNNNNEEEEEC】");
+	}
+
+	com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_tiaomacheng_xinghao")));
+	std::string setting_tiaomacheng_xinghao = CSetting::GetParam("setting_tiaomacheng_xinghao");
+
+	if (setting_tiaomacheng_xinghao == "dahua_tm")
+	{
+		com->SetInternVisible(true);
+		com->SelectItem(0, false, false);
+		com->SetText(L"大华TM系列");
+	}
+
+	std::string setting_tiaomacheng_ip = CSetting::GetParam("setting_tiaomacheng_ip");
+
+	CEditUI* tiaoma_ip_edit = static_cast<CEditUI*>(this->FindSubControl(_T("setting_tiaomacheng_ip")));
+	tiaoma_ip_edit->SetText(CLewaimaiString::UTF8ToUnicode(setting_tiaomacheng_ip).c_str());
+
 	//系统设置
 	box = static_cast<CCheckBoxUI*>(this->FindSubControl(_T("setting_is_auto_start")));
 	if (CSetting::GetParam("setting_is_auto_start") == "1")
@@ -1233,6 +1303,17 @@ void CSettingPageUI::HandleClickMsg(TNotifyUI& msg)
 		CSetting::DelChufangPrinter(CLewaimaiString::UnicodeToUTF8(date));
 		pPrinterList->Remove(pEle);
 	}
+	else if (name == L"setting_tiaomacheng_saveip")
+	{
+		CEditUI* wangkou_ip = static_cast<CEditUI*>(this->FindSubControl(_T("setting_tiaomacheng_ip")));
+		wstring ip = wangkou_ip->GetText();
+
+		CSetting::SetParam("setting_tiaomacheng_ip", CLewaimaiString::UnicodeToUTF8(ip));
+	}
+	else if (name == L"setting_tiaomacheng_tongbushangpin")
+	{
+		this->StartTongbuBiaoqiancheng();
+	}
 	else if (name == _T("setting_logout"))
 	{
 		//退出登录
@@ -1276,21 +1357,26 @@ void CSettingPageUI::HandleSelectChangeMsg(TNotifyUI& msg)
 		CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
 		pControl->SelectItem(5);
 	}
-	else if (name == _T("setting_xianshi_switch"))
+	else if (name == _T("setting_tiaomacheng_switch"))
 	{
 		CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
 		pControl->SelectItem(6);
 	}
-	else if (name == _T("setting_system_switch"))
+	else if (name == _T("setting_xianshi_switch"))
 	{
 		CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
 		pControl->SelectItem(7);
 	}
-	else if (name == _T("setting_system_about"))
+	else if (name == _T("setting_system_switch"))
 	{
 		CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
 		pControl->SelectItem(8);
 	}
+	else if (name == _T("setting_system_about"))
+	{
+		CTabLayoutUI* pControl = static_cast<CTabLayoutUI*>(this->FindSubControl(_T("setting_switch")));
+		pControl->SelectItem(9);
+	}
 	else if (name == _T("xianshi_setting_youtu"))
 	{
 		CSetting::SetParam("setting_xianshi_is_youtu", "1");
@@ -1501,6 +1587,22 @@ void CSettingPageUI::HandleItemSelectMsg(TNotifyUI& msg)
 
 		CChengzhongWorker::GetInstance()->RestartWork();
 	}
+	else if (name == _T("setting_tiaomacheng_geshi"))
+	{
+		CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_tiaomacheng_geshi")));
+		int nSelect = com->GetCurSel();
+
+		CSetting::SetParam("setting_tiaomacheng_geshi", to_string(nSelect + 1));
+	}
+	else if (name == _T("setting_tiaomacheng_xinghao"))
+	{
+		CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_tiaomacheng_xinghao")));
+
+		if (com->GetCurSel() == 0)
+		{
+			CSetting::SetParam("setting_tiaomacheng_xinghao", "dahua_tm");
+		}
+	}
 	else if (name == _T("setting_biaoqian_printer_usb"))
 	{
 		CComboUI* com = static_cast<CComboUI*>(this->FindSubControl(_T("setting_biaoqian_printer_usb")));
@@ -1554,4 +1656,118 @@ void CSettingPageUI::HandleTextChangedMsg(TNotifyUI& msg)
 void CSettingPageUI::HandleTextCapture(std::string content)
 {
 
+}
+
+void CSettingPageUI::StartTongbuBiaoqiancheng()
+{
+	boost::asio::io_service m_io;
+	boost::asio::ip::tcp::socket m_socket(m_io);
+
+	//读取厨房打印机信息
+	std::string ip = CSetting::GetParam("setting_tiaomacheng_ip");
+
+
+	//初始化连接
+	try
+	{
+		boost::asio::ip::tcp::endpoint ep(boost::asio::ip::address::from_string(ip.c_str()), 4001);
+		m_socket.connect(ep);
+	}
+	catch (std::exception& e)
+	{
+		std::string err = e.what();
+		LOG_INFO("厨房网口打印机连接失败,IP地址:" << ip.c_str() << ",错误信息:" << err.c_str());
+
+		MessageBoxW(NULL, (L"厨房网口打印机连接失败,IP地址:" + CLewaimaiString::UTF8ToUnicode(ip)).c_str(), L"打印机连接失败", MB_OK);
+
+		//连接失败了,处理下一个厨房打印机
+		return;
+	}
+
+	//!0V + 4位PLU + A + 7位商品编码 + 6位数价格(单位分) + 模式(0:称重,1:计件,2:定重) + 000000 + 3位有效期 + 2位店号(01-99)+ 000000000000000 + 2位皮重(00-15)+
+	//+	0000000000000000000000000000000B + 商品名称区位码 + CDE + 换行符
+
+	//这个是要发送的数据
+	std::string data = "";
+
+	CSqlite3 sqlite;
+
+	/*
+	//先发送清空命令
+	data += "!0IA";
+	data += 0x0d;
+
+	data += 0x0a;
+
+	//data += 0x03;
+
+	data += "!0HA";
+	data += 0x0d;
+
+	data += 0x0a;
+
+	//data += 0x03;
+	//*/
+
+	for (int i = 1; i <= 1; i++)
+	{
+		data += "!0V";
+
+		data += "1001";
+
+		data += "A";
+
+		std::string shangpin_bianma = to_string(50000 + i);
+
+		data += CLewaimaiString::BuZifuLeft(shangpin_bianma, 2, '0');
+
+		std::string price = to_string((int)(5.50 * 100));
+
+		data += CLewaimaiString::BuZifuLeft(price, 6 - price.length(), '0');
+
+		data += '0';
+
+		data += "000000";
+
+		//有效期
+		data += "000";
+
+		//店号
+		data += "01";
+
+		data += "000000000000000";
+
+		data += "00";
+
+		data += "0000000000000000000000000000000B";
+
+		std::string quweima = CLewaimaiString::GetQuweima(L"刘刘1刘abc");
+
+		data += quweima;
+
+		data += "CDE";
+
+		data += 0x0d;
+
+		data += 0x0a;
+
+		//data += 0x03;
+	}
+
+	//网口走这里
+	try
+	{
+		m_socket.write_some(boost::asio::buffer(data.c_str(), data.length()));
+	}
+	catch (const std::exception& e)
+	{
+		LOG_INFO("网口打印机发送消息失败,错误信息:" << e.what());
+	}
+
+	boost::array<char, 128> buf;
+	boost::system::error_code error;
+
+	size_t len = m_socket.read_some(boost::asio::buffer(buf), error);
+
+	m_socket.close();
 }

+ 2 - 0
zhipuzi_pos_windows/page/CSettingPageUI.h

@@ -26,5 +26,7 @@ public:
 
 	//处理扫码枪捕捉到的扫码信息
 	void HandleTextCapture(std::string content);
+
+	void StartTongbuBiaoqiancheng();
 };
 

+ 20 - 0
zhipuzi_pos_windows/tool/CSetting.cpp

@@ -259,6 +259,26 @@ void CSetting::Init()
 		m_paramsMap[setting_dianzicheng_botelv] = "9600";
 	}
 
+	//条码秤参数
+	std::string setting_tiaomacheng_geshi = "setting_tiaomacheng_geshi";
+	if (m_paramsMap.find(setting_tiaomacheng_geshi) == m_paramsMap.end())
+	{
+		//用数字1到8,分别表示8个格式
+		m_paramsMap[setting_tiaomacheng_geshi] = "1";
+	}
+
+	std::string setting_tiaomacheng_xinghao = "setting_tiaomacheng_xinghao";
+	if (m_paramsMap.find(setting_tiaomacheng_xinghao) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_tiaomacheng_xinghao] = "dahua_tm";
+	}
+
+	std::string setting_tiaomacheng_ip = "setting_tiaomacheng_ip";
+	if (m_paramsMap.find(setting_tiaomacheng_ip) == m_paramsMap.end())
+	{
+		m_paramsMap[setting_tiaomacheng_ip] = "";
+	}
+
 	//系统设置的参数
 	std::string setting_is_auto_start = "setting_is_auto_start";
 	if (CSystem::IsAutoStart() == true)

+ 0 - 3
zhipuzi_pos_windows/tool/CSqlite3.h

@@ -58,9 +58,6 @@ public:
 
 	//更新商品ID的库存
 	void UpdateFoodStock(std::string food_id, std::string stock);
-
-	//通过商品id,
-
 private:
 	bool ExeSQl(std::string sql);
 

+ 2 - 1
zhipuzi_pos_windows/wnd/CYouhuiShowWnd.cpp

@@ -92,6 +92,7 @@ LRESULT CYouhuiShowWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam,
 		}
 		else if (wParam == VK_ESCAPE)
 		{
+			Close(IDCANCEL);
 			return true;
 		}
 	}
@@ -131,7 +132,7 @@ void CYouhuiShowWnd::Notify(TNotifyUI& msg)
 	{
 		DuiLib::CDuiString senderName = msg.pSender->GetName();
 
-		if (senderName == _T("quit"))
+		if (senderName == _T("closebtn"))
 		{
 			Close(IDCANCEL);
 			return;