张洋 hai 1 día
pai
achega
6aac8cd7b6

+ 3 - 1
.gitignore

@@ -9,4 +9,6 @@ dump
 /bin/Win32/Release/zhipuzi_pos_windows/zhipuzi_pos_windows.exe
 /bin/Win32/Release/zhipuzi_pos_windows/zhipuzi_pos_windows.exe
 images
 images
 .vs
 .vs
-x64
+x64
+/opencv-test/test/Release
+/opencv-test/test/Debug

+ 2 - 2
bin/Win32/Debug/zhipuzi_pos_windows/skin/diandan_page.xml

@@ -60,7 +60,7 @@
 						<Button name="btn_diandan_cundan" width="90" height="40" padding="10,10,10,0" text="存单" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'" />
 						<Button name="btn_diandan_cundan" width="90" height="40" padding="10,10,10,0" text="存单" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'" />
 						<Button name="btn_diandan_qudan" width="90" height="40" padding="10,10,10,0" text="取单" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'" />
 						<Button name="btn_diandan_qudan" width="90" height="40" padding="10,10,10,0" text="取单" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'" />
 						
 						
-						<Label name="diandan_page_qudan_num" text="10" mouse="false" width="19" height="19" align="center" textcolor="#FFFFFFFF" bkimage="num_bkg.png" float="true" pos="85,325,104,274" bordercolor="#FFFF0000" bordersize="0"></Label>
+						<Label name="diandan_page_qudan_num" text="10" mouse="false" width="19" height="19" align="center" float="true" pos="85,325,104,344" textcolor="#FFFFFFFF" bkimage="num_bkg.png" bordercolor="#FFFF0000" bordersize="0"></Label>
 						
 						
 						<Button name="btn_diandan_zhengdanbeizhu" width="90" height="40" padding="10,10,10,0" text="整单备注" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'" />
 						<Button name="btn_diandan_zhengdanbeizhu" width="90" height="40" padding="10,10,10,0" text="整单备注" normalimage="file='btn_border_white.png' corner='5,5,5,5'" hotimage="file='btn_border_white_Hover.png' corner='5,5,5,5'" pushedimage="file='btn_border_white_Click.png' corner='5,5,5,5'" />
 						
 						
@@ -118,7 +118,7 @@
 					
 					
 					<Control bkimage="search_icon.png" width="25" height="26" pos="45,23,70,49" float="true"></Control>
 					<Control bkimage="search_icon.png" width="25" height="26" pos="45,23,70,49" float="true"></Control>
 					
 					
-					<Button name="diandan_food_search_clear" visible="false" normalimage="search_clear.png" hotimage="search_clear.png" pushedimage="search_clear.png" bkimage="search_clear.png" width="23" height="23" pos="365,23,68,46" float="true"></Button>
+					<Button name="diandan_food_search_clear" visible="false" width="23" height="23" pos="365,23,388,46" float="true" normalimage="search_clear.png" hotimage="search_clear.png" pushedimage="search_clear.png" bkimage="search_clear.png"></Button>
 
 
 					<Button name="diandan_page_aixuexi_btn" width="120" height="50" text="AI学习" textcolor="#FFFFFFFF" padding="30,10,0,0" normalimage="file='btn_green_zhengchang.png' corner='5,5,5,5'" hotimage="file='btn_green_xuanfu.png' corner='5,5,5,5'" pushedimage="file='btn_green_dianji.png' corner='5,5,5,5'" />
 					<Button name="diandan_page_aixuexi_btn" width="120" height="50" text="AI学习" textcolor="#FFFFFFFF" padding="30,10,0,0" normalimage="file='btn_green_zhengchang.png' corner='5,5,5,5'" hotimage="file='btn_green_xuanfu.png' corner='5,5,5,5'" pushedimage="file='btn_green_dianji.png' corner='5,5,5,5'" />
 				</HorizontalLayout>
 				</HorizontalLayout>

+ 48 - 48
bin/Win32/Debug/zhipuzi_pos_windows/skin/virtual_keyboard.xml

@@ -1,101 +1,101 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <?xml version="1.0" encoding="UTF-8"?>
-<Window size="955,275" caption="0,0,0,20" roundcorner="4,4">
-     <Font id="0" name="微软雅黑" size="20" default="true" />
+<Window size="780,225" caption="0,0,0,16" roundcorner="3,3">
+     <Font id="0" name="微软雅黑" size="16" default="true" />
      <VerticalLayout bkcolor="#FF000000">
      <VerticalLayout bkcolor="#FF000000">
-          <HorizontalLayout height="20" bkcolor="#FF000000">
+          <HorizontalLayout height="16" bkcolor="#FF000000">
                <Control />
                <Control />
-      <Button name="closebtn" text="X" width="30" height="18" bkcolor="#FF000000" 
+      <Button name="closebtn" text="X" width="24" height="15" bkcolor="#FF000000" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
     </HorizontalLayout>
     </HorizontalLayout>
 
 
-     <HorizontalLayout height="60" childpadding="8" padding="3,3,3,3">
-      <Button name="btn_q" text="q" width="65" height="55" bkcolor="#FF302F37" 
+     <HorizontalLayout height="49" childpadding="7" padding="2,2,2,2">
+      <Button name="btn_q" text="q" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_w" text="w" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_w" text="w" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_e" text="e" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_e" text="e" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_r" text="r" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_r" text="r" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_t" text="t" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_t" text="t" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_y" text="y" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_y" text="y" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_u" text="u" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_u" text="u" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_i" text="i" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_i" text="i" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_o" text="o" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_o" text="o" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_p" text="p" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_p" text="p" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_backspace" text="Backspace" width="150" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_backspace" text="Backspace" width="122" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
     </HorizontalLayout>
     </HorizontalLayout>
 
 
-     <HorizontalLayout height="60" childpadding="8" padding="3,3,3,3">
-      <Control width="40" height="55" bkcolor="#FF000000"/>
-      <Button name="btn_a" text="a" width="65" height="55" bkcolor="#FF302F37" 
+     <HorizontalLayout height="49" childpadding="7" padding="2,2,2,2">
+      <Control width="33" height="45" bkcolor="#FF000000"/>
+      <Button name="btn_a" text="a" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_s" text="s" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_s" text="s" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_d" text="d" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_d" text="d" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_f" text="f" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_f" text="f" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_g" text="g" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_g" text="g" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_h" text="h" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_h" text="h" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_j" text="j" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_j" text="j" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_k" text="k" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_k" text="k" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_l" text="l" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_l" text="l" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-     <Button name="btn_apos" text="&apos;" width="65" height="55" bkcolor="#FF302F37" 
+     <Button name="btn_apos" text="&apos;" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_enter" text="Enter" width="130" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_enter" text="Enter" width="106" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
     </HorizontalLayout>
     </HorizontalLayout>
 
 
-     <HorizontalLayout height="60" childpadding="8" padding="3,3,3,3">
-      <Button name="btn_shift_l" text="Shift" width="65" height="55" bkcolor="#FF302F37" 
+     <HorizontalLayout height="49" childpadding="7" padding="2,2,2,2">
+      <Button name="btn_shift_l" text="Shift" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_z" text="z" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_z" text="z" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_x" text="x" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_x" text="x" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_c" text="c" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_c" text="c" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_v" text="v" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_v" text="v" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_b" text="b" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_b" text="b" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_n" text="n" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_n" text="n" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_m" text="m" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_m" text="m" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_comma" text="," width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_comma" text="," width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_dot" text="." width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_dot" text="." width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_question" text="?" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_question" text="?" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_shift_r" text="Shift" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_shift_r" text="Shift" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
     </HorizontalLayout>
     </HorizontalLayout>
 
 
-     <HorizontalLayout height="60" childpadding="8" padding="3,3,3,3">
-      <Button name="btn_num_symbol" text="&amp;123" width="65" height="55" bkcolor="#FF302F37" 
+     <HorizontalLayout height="49" childpadding="7" padding="2,2,2,2">
+      <Button name="btn_num_symbol" text="123" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_ctrl" text="Ctrl" width="65" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_ctrl" text="Ctrl" width="53" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_handwriting" text="手写板" width="120" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_handwriting" text="手写板" width="98" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_space" text="空格" width="460" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_space" text="空格" width="376" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
-      <Button name="btn_switch_ime" text="切换输入法" width="120" height="55" bkcolor="#FF302F37" 
+      <Button name="btn_switch_ime" text="中/英" width="98" height="45" bkcolor="#FF302F37" 
            textcolor="#FFFFFFFF" align="center"/>
            textcolor="#FFFFFFFF" align="center"/>
     </HorizontalLayout>
     </HorizontalLayout>
   </VerticalLayout>
   </VerticalLayout>

+ 1 - 0
zhipuzi_pos_windows/wnd/CMainWnd.cpp

@@ -61,6 +61,7 @@ void CMainWnd::Init()
 	//启动一个线程,开始同步商品图片
 	//启动一个线程,开始同步商品图片
 	std::thread(&CMainWnd::UpdateFoodImage, this).detach();
 	std::thread(&CMainWnd::UpdateFoodImage, this).detach();
 
 
+	//展示虚拟键盘(暂时测试用,不完善)
 	this->ShowVK(true);
 	this->ShowVK(true);
 }
 }
 
 

+ 80 - 9
zhipuzi_pos_windows/wnd/CVirtualKeyboardWnd.cpp

@@ -96,6 +96,9 @@ void CVirtualKeyboardWnd::InitWindow()
 	UpdateTargetWindow();
 	UpdateTargetWindow();
 	UpdateLetterButtonsText();
 	UpdateLetterButtonsText();
 	UpdateModifierButtonsState();
 	UpdateModifierButtonsState();
+
+	SetButtonText(m_pm, _T("btn_num_symbol"), _T("&123"));
+	SetButtonText(m_pm, _T("btn_switch_ime"), _T("中/英"));
 }
 }
 
 
 void CVirtualKeyboardWnd::Notify(TNotifyUI& msg)
 void CVirtualKeyboardWnd::Notify(TNotifyUI& msg)
@@ -161,7 +164,7 @@ void CVirtualKeyboardWnd::Notify(TNotifyUI& msg)
 
 
 		if (sName == _T("btn_switch_ime"))
 		if (sName == _T("btn_switch_ime"))
 		{
 		{
-			SimulateSpecialKey(VK_CONTROL | VK_SHIFT);
+			ToggleImeLanguageMode();
 			return;
 			return;
 		}
 		}
 
 
@@ -187,7 +190,7 @@ void CVirtualKeyboardWnd::Notify(TNotifyUI& msg)
 
 
 void CVirtualKeyboardWnd::SimulateKeyPress(TCHAR ch)
 void CVirtualKeyboardWnd::SimulateKeyPress(TCHAR ch)
 {
 {
-   SHORT vkInfo = ::VkKeyScan(ch);
+	SHORT vkInfo = ::VkKeyScan(ch);
 	if (vkInfo == -1)
 	if (vkInfo == -1)
 	{
 	{
 		return;
 		return;
@@ -233,7 +236,7 @@ void CVirtualKeyboardWnd::SimulateSpecialKey(int vkCode)
 {
 {
 	if (vkCode == (VK_CONTROL | VK_SHIFT))
 	if (vkCode == (VK_CONTROL | VK_SHIFT))
 	{
 	{
-     ::keybd_event(VK_CONTROL, static_cast<BYTE>(::MapVirtualKey(VK_CONTROL, 0)), 0, 0);
+		::keybd_event(VK_CONTROL, static_cast<BYTE>(::MapVirtualKey(VK_CONTROL, 0)), 0, 0);
 		::keybd_event(VK_SHIFT, static_cast<BYTE>(::MapVirtualKey(VK_SHIFT, 0)), 0, 0);
 		::keybd_event(VK_SHIFT, static_cast<BYTE>(::MapVirtualKey(VK_SHIFT, 0)), 0, 0);
 		::keybd_event(VK_SHIFT, static_cast<BYTE>(::MapVirtualKey(VK_SHIFT, 0)), KEYEVENTF_KEYUP, 0);
 		::keybd_event(VK_SHIFT, static_cast<BYTE>(::MapVirtualKey(VK_SHIFT, 0)), KEYEVENTF_KEYUP, 0);
 		::keybd_event(VK_CONTROL, static_cast<BYTE>(::MapVirtualKey(VK_CONTROL, 0)), KEYEVENTF_KEYUP, 0);
 		::keybd_event(VK_CONTROL, static_cast<BYTE>(::MapVirtualKey(VK_CONTROL, 0)), KEYEVENTF_KEYUP, 0);
@@ -245,24 +248,24 @@ void CVirtualKeyboardWnd::SimulateSpecialKey(int vkCode)
 
 
 	if (useCtrl)
 	if (useCtrl)
 	{
 	{
-      ::keybd_event(VK_CONTROL, static_cast<BYTE>(::MapVirtualKey(VK_CONTROL, 0)), 0, 0);
+		::keybd_event(VK_CONTROL, static_cast<BYTE>(::MapVirtualKey(VK_CONTROL, 0)), 0, 0);
 	}
 	}
 	if (useShift)
 	if (useShift)
 	{
 	{
-        ::keybd_event(VK_SHIFT, static_cast<BYTE>(::MapVirtualKey(VK_SHIFT, 0)), 0, 0);
+		::keybd_event(VK_SHIFT, static_cast<BYTE>(::MapVirtualKey(VK_SHIFT, 0)), 0, 0);
 	}
 	}
 
 
- ::keybd_event(static_cast<BYTE>(vkCode), static_cast<BYTE>(::MapVirtualKey(vkCode, 0)), 0, 0);
+	::keybd_event(static_cast<BYTE>(vkCode), static_cast<BYTE>(::MapVirtualKey(vkCode, 0)), 0, 0);
 	::keybd_event(static_cast<BYTE>(vkCode), static_cast<BYTE>(::MapVirtualKey(vkCode, 0)), KEYEVENTF_KEYUP, 0);
 	::keybd_event(static_cast<BYTE>(vkCode), static_cast<BYTE>(::MapVirtualKey(vkCode, 0)), KEYEVENTF_KEYUP, 0);
 
 
 	if (useShift)
 	if (useShift)
 	{
 	{
-      ::keybd_event(VK_SHIFT, static_cast<BYTE>(::MapVirtualKey(VK_SHIFT, 0)), KEYEVENTF_KEYUP, 0);
+		::keybd_event(VK_SHIFT, static_cast<BYTE>(::MapVirtualKey(VK_SHIFT, 0)), KEYEVENTF_KEYUP, 0);
 		m_bIsShiftDown = false;
 		m_bIsShiftDown = false;
 	}
 	}
 	if (useCtrl)
 	if (useCtrl)
 	{
 	{
-        ::keybd_event(VK_CONTROL, static_cast<BYTE>(::MapVirtualKey(VK_CONTROL, 0)), KEYEVENTF_KEYUP, 0);
+		::keybd_event(VK_CONTROL, static_cast<BYTE>(::MapVirtualKey(VK_CONTROL, 0)), KEYEVENTF_KEYUP, 0);
 		m_bIsCtrlDown = false;
 		m_bIsCtrlDown = false;
 	}
 	}
 
 
@@ -270,6 +273,74 @@ void CVirtualKeyboardWnd::SimulateSpecialKey(int vkCode)
 	UpdateModifierButtonsState();
 	UpdateModifierButtonsState();
 }
 }
 
 
+void CVirtualKeyboardWnd::ToggleImeLanguageMode()
+{
+	RestoreTargetWindow();
+
+	HWND hTarget = GetTargetWindow();
+	if (hTarget == NULL)
+	{
+		return;
+	}
+
+	HWND hImeWnd = ::ImmGetDefaultIMEWnd(hTarget);
+	if (hImeWnd != NULL)
+	{
+      HIMC hImc = ::ImmGetContext(hTarget);
+		if (hImc != NULL)
+		{
+			BOOL isOpen = ::ImmGetOpenStatus(hImc);
+			::ImmSetOpenStatus(hImc, isOpen ? FALSE : TRUE);
+
+			if (!isOpen)
+			{
+				DWORD conversion = 0;
+				DWORD sentence = 0;
+				if (::ImmGetConversionStatus(hImc, &conversion, &sentence))
+				{
+					::ImmSetConversionStatus(hImc, conversion | IME_CMODE_NATIVE, sentence);
+				}
+			}
+
+			::ImmReleaseContext(hTarget, hImc);
+		}
+
+		RestoreTargetWindow();
+		return;
+	}
+
+	DWORD dwThreadId = ::GetWindowThreadProcessId(hTarget, NULL);
+	HKL hkl = ::GetKeyboardLayout(dwThreadId);
+	if (!::ImmIsIME(hkl))
+	{
+		RestoreTargetWindow();
+		return;
+	}
+
+	HIMC hImc = ::ImmGetContext(hTarget);
+	if (hImc == NULL)
+	{
+		::ImmSimulateHotKey(hTarget, IME_CHOTKEY_IME_NONIME_TOGGLE);
+		RestoreTargetWindow();
+		return;
+	}
+
+	BOOL isOpen = ::ImmGetOpenStatus(hImc);
+	::ImmSetOpenStatus(hImc, isOpen ? FALSE : TRUE);
+	if (!isOpen)
+	{
+		DWORD conversion = 0;
+		DWORD sentence = 0;
+		if (::ImmGetConversionStatus(hImc, &conversion, &sentence))
+		{
+			::ImmSetConversionStatus(hImc, conversion | IME_CMODE_NATIVE, sentence);
+		}
+	}
+	::ImmReleaseContext(hTarget, hImc);
+
+	RestoreTargetWindow();
+}
+
 void CVirtualKeyboardWnd::SimulateShiftPress(bool bPress)
 void CVirtualKeyboardWnd::SimulateShiftPress(bool bPress)
 {
 {
 	m_bIsShiftDown = bPress;
 	m_bIsShiftDown = bPress;
@@ -376,7 +447,7 @@ HWND CreateVirtualKeyboard()
 	CVirtualKeyboardWnd* pKeyboard = new CVirtualKeyboardWnd();
 	CVirtualKeyboardWnd* pKeyboard = new CVirtualKeyboardWnd();
 	if (pKeyboard)
 	if (pKeyboard)
 	{
 	{
-      return pKeyboard->Create(nullptr, _T("虚拟键盘"), WS_POPUP, WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE);
+		return pKeyboard->Create(nullptr, _T("虚拟键盘"), WS_POPUP, WS_EX_TOPMOST | WS_EX_TOOLWINDOW | WS_EX_NOACTIVATE);
 	}
 	}
 	return nullptr;
 	return nullptr;
 }
 }

+ 1 - 0
zhipuzi_pos_windows/wnd/CVirtualKeyboardWnd.h

@@ -53,6 +53,7 @@ private:
 	void SimulateKeyPress(TCHAR ch);
 	void SimulateKeyPress(TCHAR ch);
 	void SimulateSpecialKey(int vkCode);
 	void SimulateSpecialKey(int vkCode);
 	void SimulateShiftPress(bool bPress);
 	void SimulateShiftPress(bool bPress);
+	void ToggleImeLanguageMode();
 
 
 	// 辅助功能
 	// 辅助功能
 	void ToggleShift();
 	void ToggleShift();