Prechádzať zdrojové kódy

订单列表的写好了

zhangyang 6 rokov pred
rodič
commit
1eaa1709f0

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 487 - 0
bin/Win32/Debug/zhipuzi_pos_windows/log/pos.log


+ 0 - 29
bin/Win32/Debug/zhipuzi_pos_windows/skin/desk.xml

@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Window>
-	<WaimaiOrderItem height="200" padding="0,0,0,0" bkcolor="#FFFFFFFF">
-		<HorizontalLayout>
-			<Label float="true" name="waimai_order_list_order_no" text="订单号:" pos="10,6,300,36" />
-			<Label float="true" name="waimai_order_list_name" text="姓名:" pos="10,36,182,66" />
-			<Label float="true" name="waimai_order_list_phone" text="电话:" pos="320,36,600,66" />
-			<Label float="true" name="waimai_order_list_address" text="地址:" pos="10,66,182,96" />
-			<Label float="true" name="waimai_order_list_init_date" text="下单时间:" pos="10,96,220,126" />
-			<Label float="true" name="waimai_order_list_type" text="订单类型:" pos="10,126,182,156" />
-			<Label float="true" name="waimai_order_list_delivery_date" text="配送时间:" pos="10,156,182,186" />
-			
-			<Label float="true" name="waimai_order_list_refund_status" text="退款状态:" pos="320,156,800,186" />
-			
-			<Label float="true" name="waimai_order_list_price" text="价格:" pos="320,6,482,36" />
-		</HorizontalLayout>
-		<HorizontalLayout width="200">
-			<Button name="waimai_order_list_info" float="true" pos="100,6,180,44" 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'"/>
-			<Button name="waimai_order_list_print" float="true" pos="100,54,180,92" 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'"/>
-			
-			<Button name="waimai_order_list_confirme" float="true" pos="100,112,180,150" text="确认" textcolor="#FFFFFFFF"/>
-			<Button name="waimai_order_list_success" float="true" pos="100,112,180,150" text="设为成功" textcolor="#FFFFFFFF"/>
-			<Button name="waimai_order_list_fail" float="true" pos="100,160,180,198" text="设为失败" textcolor="#FFFFFFFF" normalimage="file='Btn_Red.png' corner='5,5,5,5'" hotimage="file='Btn_Red_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_Red_Click.png' corner='5,5,5,5'"/>
-			
-			<Button name="waimai_order_list_agree" float="true" pos="100,112,180,150" text="同意退款" textcolor="#FFFFFFFF"/>
-			<Button name="waimai_order_list_disagree" float="true" pos="100,160,180,198" text="拒绝退款" textcolor="#FFFFFFFF" normalimage="file='Btn_Red.png' corner='5,5,5,5'" hotimage="file='Btn_Red_Hover.png' corner='5,5,5,5'" pushedimage="file='Btn_Red_Click.png' corner='5,5,5,5'"/>
-		</HorizontalLayout>
-	</WaimaiOrderItem>
-</Window>

Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 0 - 117
bin/Win32/Debug/zhipuzi_pos_windows/skin/hall.xml


Rozdielové dáta súboru neboli zobrazené, pretože súbor je príliš veľký
+ 4 - 2
bin/Win32/Debug/zhipuzi_pos_windows/skin/main.xml


+ 14 - 4
bin/Win32/Debug/zhipuzi_pos_windows/skin/waimaiorder_info.xml

@@ -39,10 +39,20 @@
 
 				<Label text="顾客信息" height="30" />
 				<Control height="1" bkcolor="#FF708090" />
-				<Label name="waimai_order_info_page_name" text="姓名:" height="30" textcolor="#FF558CC4" mouse="false" />
-				<Label name="waimai_order_info_page_phone" text="电话:" height="30" textcolor="#FF558CC4" mouse="false" />
-				<Label name="waimai_order_info_page_address" text="地址:" height="30" textcolor="#FF558CC4" mouse="false" />
-				<Label name="waimai_order_info_page_init_date" text="下单时间:" height="30" textcolor="#FF558CC4" mouse="false" />
+				<Label name="waimai_order_info_page_name" text="姓名:" height="30" />
+				<Label name="waimai_order_info_page_phone" text="电话:" height="30" />
+				<Label name="waimai_order_info_page_address" text="地址:" height="30" />
+				<Label name="waimai_order_info_page_init_date" text="下单时间:" height="30" />
+				
+				<VerticalLayout name="waimai_order_info_page_qishouinfo">
+					<Control height="15" bkcolor="#FFEFF6EE" />
+
+					<Label text="骑手信息" height="30" />
+					<Control height="1" bkcolor="#FF708090" />
+					<Label name="waimai_order_info_page_qishou_name" text="骑手姓名:" height="30" />
+					<Label name="waimai_order_info_page_qishou_phone" text="骑手电话:" height="30" />
+					<Label name="waimai_order_info_page_qishou_type" text="骑手类型:" height="30" />
+				</VerticalLayout>
 
 				<Control height="15" bkcolor="#FFEFF6EE" />
 

BIN
bin/Win32/Debug/zhipuzi_pos_windows/zhipuzi_pos_windows.exe


+ 33 - 0
lewaimai_dispatch/wnd/CWaimaiOrderInfoUI.cpp

@@ -214,6 +214,39 @@ void CWaimaiOrderInfoUI::Refresh(CWaimaiOrder& order)
 	std::wstring order_date_show = L"下单时间:" + CLewaimaiString::UTF8ToUnicode(order.m_order_date);
 	this->FindSubControl(_T("waimai_order_info_page_init_date"))->SetText(order_date_show.c_str());
 
+	//开始处理骑手信息
+	if (atoi(order.m_courier_id.c_str()) > 0)
+	{
+		//有人接单了
+		this->FindSubControl(_T("waimai_order_info_page_qishouinfo"))->SetVisible(true);
+
+		std::wstring qishou_name = L"骑手姓名:" + CLewaimaiString::UTF8ToUnicode(order.m_courier_name);
+		this->FindSubControl(_T("waimai_order_info_page_qishou_name"))->SetText(qishou_name.c_str());
+
+		std::wstring qishou_phone = L"骑手电话:" + CLewaimaiString::UTF8ToUnicode(order.m_courier_phone);
+		this->FindSubControl(_T("waimai_order_info_page_qishou_phone"))->SetText(qishou_phone.c_str());
+
+		std::wstring qishou_type;
+		if (order.m_courier_type == "3")
+		{
+			qishou_type = L"骑手类型:快服务骑手";
+		}
+		else if (order.m_courier_type == "5")
+		{
+			qishou_type = L"骑手类型:达达骑手";
+		}
+		else
+		{
+			qishou_type = L"骑手类型:商家自配送骑手";
+		}
+
+		this->FindSubControl(_T("waimai_order_info_page_qishou_type"))->SetText(qishou_type.c_str());
+	}
+	else
+	{
+		this->FindSubControl(_T("waimai_order_info_page_qishouinfo"))->SetVisible(false);
+	}
+
 	if (order.m_is_selftake == "1")
 	{
 		CLabelUI *pDeliveryType = static_cast<CLabelUI *>(this->FindSubControl(_T("waimai_order_info_page_delivery_type")));

lewaimai_dispatch/wnd/CWaimaiOrderInfoUI.h → lewaimai_dispatch/control/CWaimaiOrderInfoUI.h


lewaimai_dispatch/wnd/CWaimaiOrderItemUI.cpp → lewaimai_dispatch/control/CWaimaiOrderItemUI.cpp


lewaimai_dispatch/wnd/CWaimaiOrderItemUI.h → lewaimai_dispatch/control/CWaimaiOrderItemUI.h


lewaimai_dispatch/wnd/ControlEx.h → lewaimai_dispatch/control/ControlEx.h


+ 10 - 6
lewaimai_dispatch/wnd/OrderListUI.cpp

@@ -111,17 +111,21 @@ void OrderListUI::Refresh()
 		CDialogBuilder builder;
 		CDialogBuilderCallbackEx cb;
 
-		CWaimaiOrderItemUI* pDesk = static_cast<CWaimaiOrderItemUI*>(builder.Create(_T("desk.xml"), (UINT)0, &cb, m_pManager));							
-		if (pDesk != NULL)
+		CWaimaiOrderItemUI* pItem = static_cast<CWaimaiOrderItemUI*>(builder.Create(_T("waimai_order_item.xml"), (UINT)0, &cb, m_pManager));
+		if (pItem != NULL)
 		{
 			//初始化该对应的数据
-			pDesk->SetStatus(m_status);
+			pItem->SetStatus(m_status);
 
-			pDesk->SetData(v_row_i);
+			pItem->SetData(v_row_i);
 
-			this->Add(pDesk);
+			this->Add(pItem);
 
-			pDesk = NULL;
+			pItem = NULL;
+		}
+		else
+		{
+			LOG_INFO("create waimai_order_item fail!");
 		}
 	}
 

lewaimai_dispatch/wnd/OrderListUI.h → lewaimai_dispatch/control/OrderListUI.h


+ 9 - 11
lewaimai_dispatch/lewaimai_dispatch_windows.vcxproj

@@ -197,12 +197,12 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
-    <ClInclude Include="wnd\CWaimaiOrderInfoUI.h" />
+    <ClInclude Include="control\CWaimaiOrderInfoUI.h" />
     <ClInclude Include="network\CMessagePush.h" />
     <ClInclude Include="order\CWaimaiOrder.h" />
     <ClInclude Include="tool\CPosPrinter.h" />
-    <ClInclude Include="wnd\CWaimaiOrderItemUI.h" />
-    <ClInclude Include="wnd\CGameFrameWnd.h" />
+    <ClInclude Include="control\CWaimaiOrderItemUI.h" />
+    <ClInclude Include="wnd\CMainWnd.h" />
     <ClInclude Include="wnd\CLoginWnd.h" />
     <ClInclude Include="helper\MD5.h" />
     <ClInclude Include="network\CZhipuziHttpClient.h" />
@@ -211,22 +211,21 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="helper\CRandomHelper.h" />
     <ClInclude Include="helper\define.h" />
     <ClInclude Include="network\CHttpClient.h" />
-    <ClInclude Include="wnd\ControlEx.h" />
-    <ClInclude Include="wnd\MiniDumper.h" />
+    <ClInclude Include="control\ControlEx.h" />
     <ClInclude Include="resource\resource.h" />
     <ClInclude Include="tool\CLewaimaiLog.h" />
     <ClInclude Include="pch\pch.h" />
     <ClInclude Include="tool\CLewaimaiTime.h" />
     <ClInclude Include="helper\CSystem.h" />
-    <ClInclude Include="wnd\OrderListUI.h" />
+    <ClInclude Include="control\OrderListUI.h" />
   </ItemGroup>
   <ItemGroup>
-    <ClCompile Include="wnd\CWaimaiOrderInfoUI.cpp" />
+    <ClCompile Include="control\CWaimaiOrderInfoUI.cpp" />
     <ClCompile Include="network\CMessagePush.cpp" />
     <ClCompile Include="order\CWaimaiOrder.cpp" />
     <ClCompile Include="tool\CPosPrinter.cpp" />
-    <ClCompile Include="wnd\CWaimaiOrderItemUI.cpp" />
-    <ClCompile Include="wnd\CGameFrameWnd.cpp" />
+    <ClCompile Include="control\CWaimaiOrderItemUI.cpp" />
+    <ClCompile Include="wnd\CMainWnd.cpp" />
     <ClCompile Include="wnd\CLoginWnd.cpp" />
     <ClCompile Include="helper\MD5.cpp" />
     <ClCompile Include="network\CZhipuziHttpClient.cpp" />
@@ -235,12 +234,11 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClCompile Include="helper\CRandomHelper.cpp" />
     <ClCompile Include="helper\CSystem.cpp" />
     <ClCompile Include="network\CHttpClient.cpp" />
-    <ClCompile Include="wnd\MiniDumper.cpp" />
     <ClCompile Include="tool\CLewaimaiLog.cpp" />
     <ClCompile Include="zhipuzi_pos_windows.cpp" />
     <ClCompile Include="pch\pch.cpp" />
     <ClCompile Include="tool\CLewaimaiTime.cpp" />
-    <ClCompile Include="wnd\OrderListUI.cpp" />
+    <ClCompile Include="control\OrderListUI.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="resource\zhipuzi_pos_windows.rc" />

+ 17 - 23
lewaimai_dispatch/lewaimai_dispatch_windows.vcxproj.filters

@@ -48,37 +48,34 @@
     <ClInclude Include="helper\MD5.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="wnd\CGameFrameWnd.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
     <ClInclude Include="wnd\CLoginWnd.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="wnd\MiniDumper.h">
+    <ClInclude Include="resource\resource.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="resource\resource.h">
+    <ClInclude Include="tool\CPosPrinter.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="wnd\ControlEx.h">
+    <ClInclude Include="order\CWaimaiOrder.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="wnd\OrderListUI.h">
+    <ClInclude Include="network\CMessagePush.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="wnd\CWaimaiOrderItemUI.h">
+    <ClInclude Include="wnd\CMainWnd.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="tool\CPosPrinter.h">
+    <ClInclude Include="control\ControlEx.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="order\CWaimaiOrder.h">
+    <ClInclude Include="control\CWaimaiOrderInfoUI.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="network\CMessagePush.h">
+    <ClInclude Include="control\CWaimaiOrderItemUI.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="wnd\CWaimaiOrderInfoUI.h">
+    <ClInclude Include="control\OrderListUI.h">
       <Filter>头文件</Filter>
     </ClInclude>
   </ItemGroup>
@@ -116,31 +113,28 @@
     <ClCompile Include="wnd\CLoginWnd.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="wnd\MiniDumper.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
-    <ClCompile Include="wnd\CGameFrameWnd.cpp">
+    <ClCompile Include="tool\CPosPrinter.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="wnd\OrderListUI.cpp">
+    <ClCompile Include="order\CWaimaiOrder.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="wnd\CWaimaiOrderItemUI.cpp">
+    <ClCompile Include="network\CMessagePush.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="tool\CPosPrinter.cpp">
+    <ClCompile Include="zhipuzi_pos_windows.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="order\CWaimaiOrder.cpp">
+    <ClCompile Include="wnd\CMainWnd.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="network\CMessagePush.cpp">
+    <ClCompile Include="control\CWaimaiOrderInfoUI.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="wnd\CWaimaiOrderInfoUI.cpp">
+    <ClCompile Include="control\OrderListUI.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="zhipuzi_pos_windows.cpp">
+    <ClCompile Include="control\CWaimaiOrderItemUI.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
   </ItemGroup>

+ 1 - 1
lewaimai_dispatch/wnd/CLoginWnd.cpp

@@ -29,7 +29,7 @@ void CLoginFrameWnd::HandleLogin()
 
     if(res)
     {
-        CGameFrameWnd* pFrame = new CGameFrameWnd();
+        CMainWnd* pFrame = new CMainWnd();
         if(pFrame == NULL)
         {
             return;

+ 1 - 1
lewaimai_dispatch/wnd/CLoginWnd.h

@@ -1,7 +1,7 @@
 #pragma once
 
 #include "../pch/pch.h"
-#include "CGameFrameWnd.h"
+#include "CMainWnd.h"
 
 class CLoginFrameWnd : public CWindowWnd, public INotifyUI, public IMessageFilterUI
 {

+ 17 - 13
lewaimai_dispatch/wnd/CGameFrameWnd.cpp

@@ -1,10 +1,10 @@
 #include "../pch/pch.h"
-#include "CGameFrameWnd.h"
+#include "CMainWnd.h"
 
-#include "ControlEx.h"
-#include "CWaimaiOrderInfoUI.h"
+#include "../control/ControlEx.h"
+#include "../control/CWaimaiOrderInfoUI.h"
 
-void CGameFrameWnd::Init()
+void CMainWnd::Init()
 {
     m_pCloseBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("closebtn")));
     m_pMaxBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("maxbtn")));
@@ -12,7 +12,7 @@ void CGameFrameWnd::Init()
     m_pMinBtn = static_cast<CButtonUI*>(m_pm.FindControl(_T("minbtn")));
 }
 
-LRESULT CGameFrameWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+LRESULT CMainWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
     LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
     styleValue &= ~WS_CAPTION;
@@ -35,7 +35,7 @@ LRESULT CGameFrameWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& b
     return 0;
 }
 
-void CGameFrameWnd::Notify(TNotifyUI& msg)
+void CMainWnd::Notify(TNotifyUI& msg)
 {
     if(msg.sType == _T("windowinit"))
     {
@@ -71,7 +71,7 @@ void CGameFrameWnd::Notify(TNotifyUI& msg)
     }
 }
 
-void CGameFrameWnd::HandleClickMsg(TNotifyUI& msg)
+void CMainWnd::HandleClickMsg(TNotifyUI& msg)
 {
     if(msg.pSender == m_pCloseBtn)
     {
@@ -251,6 +251,10 @@ void CGameFrameWnd::HandleClickMsg(TNotifyUI& msg)
         {
             pControl->SelectItem(0);
         }
+
+		//刷新当前列表
+		OrderListUI* orderlist = static_cast<OrderListUI*>(m_pm.FindControl(_T("orderlist")));
+		orderlist->Refresh();
     }
     else if(name == _T("waimai_order_info_page_print"))
     {
@@ -371,7 +375,7 @@ void CGameFrameWnd::HandleClickMsg(TNotifyUI& msg)
     }
 }
 
-void CGameFrameWnd::HandleSelectChangeMsg(TNotifyUI& msg)
+void CMainWnd::HandleSelectChangeMsg(TNotifyUI& msg)
 {
     CDuiString name = msg.pSender->GetName();
 
@@ -450,7 +454,7 @@ void CGameFrameWnd::HandleSelectChangeMsg(TNotifyUI& msg)
     }
 }
 
-LRESULT CGameFrameWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
+LRESULT CMainWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
     LRESULT lRes = 0;
     BOOL bHandled = TRUE;
@@ -500,7 +504,7 @@ LRESULT CGameFrameWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
     return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
 }
 
-LRESULT CGameFrameWnd::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+LRESULT CMainWnd::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
     // 有时会在收到WM_NCDESTROY后收到wParam为SC_CLOSE的WM_SYSCOMMAND
     if(wParam == SC_CLOSE)
@@ -543,7 +547,7 @@ LRESULT CGameFrameWnd::OnSysCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOO
     return lRes;
 }
 
-LRESULT CGameFrameWnd::OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+LRESULT CMainWnd::OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
     int primaryMonitorWidth = ::GetSystemMetrics(SM_CXSCREEN);
     int primaryMonitorHeight = ::GetSystemMetrics(SM_CYSCREEN);
@@ -569,7 +573,7 @@ LRESULT CGameFrameWnd::OnGetMinMaxInfo(UINT uMsg, WPARAM wParam, LPARAM lParam,
     return 0;
 }
 
-LRESULT CGameFrameWnd::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+LRESULT CMainWnd::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
     SIZE szRoundCorner = m_pm.GetRoundCorner();
     if(!::IsIconic(*this) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0))
@@ -588,7 +592,7 @@ LRESULT CGameFrameWnd::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHa
     return 0;
 }
 
-LRESULT CGameFrameWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+LRESULT CMainWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
     POINT pt;
     pt.x = GET_X_LPARAM(lParam);

+ 3 - 3
lewaimai_dispatch/wnd/CGameFrameWnd.h

@@ -2,14 +2,14 @@
 
 #include "../pch/pch.h"
 
-#include "CWaimaiOrderItemUI.h"
+#include "../control/CWaimaiOrderItemUI.h"
 #include "../order/CWaimaiOrder.h"
 #include "../tool/CPosPrinter.h"
 
-class CGameFrameWnd : public CWindowWnd, public INotifyUI
+class CMainWnd : public CWindowWnd, public INotifyUI
 {
 public:
-    CGameFrameWnd() { };
+    CMainWnd() { };
 
     LPCTSTR GetWindowClassName() const
     {

+ 0 - 319
lewaimai_dispatch/wnd/MiniDumper.cpp

@@ -1,319 +0,0 @@
-#include <windows.h>
-#include <stdio.h>
-#include <assert.h>
-#include <time.h>
-#include <tchar.h>
-#include <dbghelp.h>
-#include "miniDumper.h"
-
-#ifdef UNICODE
-    #define _tcssprintf wsprintf
-    #define tcsplitpath _wsplitpath
-#else
-    #define _tcssprintf sprintf
-    #define tcsplitpath _splitpath
-#endif
-
-const int USER_DATA_BUFFER_SIZE = 4096;
-
-//-----------------------------------------------------------------------------
-// GLOBALS
-//-----------------------------------------------------------------------------
-CMiniDumper* CMiniDumper::s_pMiniDumper = NULL;
-LPCRITICAL_SECTION CMiniDumper::s_pCriticalSection = NULL;
-
-// Based on dbghelp.h
-typedef BOOL (WINAPI *MINIDUMPWRITEDUMP)(HANDLE hProcess,
-                                         DWORD dwPid,
-                                         HANDLE hFile,
-                                         MINIDUMP_TYPE DumpType,
-                                         CONST PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,
-                                         CONST PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,
-                                         CONST PMINIDUMP_CALLBACK_INFORMATION CallbackParam);
-
-//-----------------------------------------------------------------------------
-// Name: CMiniDumper()
-// Desc: Constructor
-//-----------------------------------------------------------------------------
-CMiniDumper::CMiniDumper( bool bPromptUserForMiniDump )
-{
-	// Our CMiniDumper should act alone as a singleton.
-	assert( !s_pMiniDumper );
-
-    s_pMiniDumper = this;
-    m_bPromptUserForMiniDump = bPromptUserForMiniDump;
-
-    // The SetUnhandledExceptionFilter function enables an application to 
-    // supersede the top-level exception handler of each thread and process.
-    // After calling this function, if an exception occurs in a process 
-    // that is not being debugged, and the exception makes it to the 
-    // unhandled exception filter, that filter will call the exception 
-    // filter function specified by the lpTopLevelExceptionFilter parameter.
-	::SetUnhandledExceptionFilter( unhandledExceptionHandler );
-
-    // Since DBGHELP.dll is not inherently thread-safe, making calls into it 
-    // from more than one thread simultaneously may yield undefined behavior. 
-    // This means that if your application has multiple threads, or is 
-    // called by multiple threads in a non-synchronized manner, you need to  
-    // make sure that all calls into DBGHELP.dll are isolated via a global
-    // critical section.
-    s_pCriticalSection = new CRITICAL_SECTION;
-
-    if( s_pCriticalSection )
-        InitializeCriticalSection( s_pCriticalSection );
-}
-
-//-----------------------------------------------------------------------------
-// Name: ~CMiniDumper()
-// Desc: Destructor
-//-----------------------------------------------------------------------------
-CMiniDumper::~CMiniDumper( void )
-{
-    if( s_pCriticalSection )
-    {
-        DeleteCriticalSection( s_pCriticalSection );
-        delete s_pCriticalSection;
-    }
-}
-
-//-----------------------------------------------------------------------------
-// Name: unhandledExceptionHandler()
-// Desc: Call-back filter function for unhandled exceptions
-//-----------------------------------------------------------------------------
-LONG CMiniDumper::unhandledExceptionHandler( _EXCEPTION_POINTERS *pExceptionInfo )
-{
-	if( !s_pMiniDumper )
-		return EXCEPTION_CONTINUE_SEARCH;
-
-	return s_pMiniDumper->writeMiniDump( pExceptionInfo );
-}
-
-//-----------------------------------------------------------------------------
-// Name: setMiniDumpFileName()
-// Desc: 
-//-----------------------------------------------------------------------------
-void CMiniDumper::setMiniDumpFileName( void )
-{
-    time_t currentTime;
-    time( &currentTime );
-
-    _tcssprintf( m_szMiniDumpPath,
-                 _T( "%s%s.%ld.dmp" ),
-                 m_szAppPath,
-                 m_szAppBaseName,
-                 currentTime );
-}
-
-//-----------------------------------------------------------------------------
-// Name: getImpersonationToken()
-// Desc: The method acts as a potential workaround for the fact that the 
-//       current thread may not have a token assigned to it, and if not, the 
-//       process token is received.
-//-----------------------------------------------------------------------------
-bool CMiniDumper::getImpersonationToken( HANDLE* phToken )
-{
-    *phToken = NULL;
-
-    if( !OpenThreadToken( GetCurrentThread(),
-                          TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES,
-                          TRUE,
-                          phToken) )
-    {
-        if( GetLastError() == ERROR_NO_TOKEN )
-        {
-            // No impersonation token for the current thread is available. 
-            // Let's go for the process token instead.
-            if( !OpenProcessToken( GetCurrentProcess(),
-                                   TOKEN_QUERY | TOKEN_ADJUST_PRIVILEGES,
-                                   phToken) )
-                return false;
-        }
-        else
-            return false;
-    }
-
-    return true;
-}
-
-//-----------------------------------------------------------------------------
-// Name: enablePrivilege()
-// Desc: Since a MiniDump contains a lot of meta-data about the OS and 
-//       application state at the time of the dump, it is a rather privileged 
-//       operation. This means we need to set the SeDebugPrivilege to be able 
-//       to call MiniDumpWriteDump.
-//-----------------------------------------------------------------------------
-BOOL CMiniDumper::enablePrivilege( LPCTSTR pszPriv, HANDLE hToken, TOKEN_PRIVILEGES* ptpOld )
-{
-    BOOL bOk = FALSE;
-
-    TOKEN_PRIVILEGES tp;
-    tp.PrivilegeCount = 1;
-    tp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
-    bOk = LookupPrivilegeValue( 0, pszPriv, &tp.Privileges[0].Luid );
-
-    if( bOk )
-    {
-        DWORD cbOld = sizeof(*ptpOld);
-        bOk = AdjustTokenPrivileges( hToken, FALSE, &tp, cbOld, ptpOld, &cbOld );
-    }
-
-    return (bOk && (ERROR_NOT_ALL_ASSIGNED != GetLastError()));
-}
-
-//-----------------------------------------------------------------------------
-// Name: restorePrivilege()
-// Desc: 
-//-----------------------------------------------------------------------------
-BOOL CMiniDumper::restorePrivilege( HANDLE hToken, TOKEN_PRIVILEGES* ptpOld )
-{
-    BOOL bOk = AdjustTokenPrivileges(hToken, FALSE, ptpOld, 0, NULL, NULL);
-    return ( bOk && (ERROR_NOT_ALL_ASSIGNED != GetLastError()) );
-}
-
-//-----------------------------------------------------------------------------
-// Name: writeMiniDump()
-// Desc: 
-//-----------------------------------------------------------------------------
-LONG CMiniDumper::writeMiniDump( _EXCEPTION_POINTERS *pExceptionInfo )
-{
-	LONG retval = EXCEPTION_CONTINUE_SEARCH;
-	m_pExceptionInfo = pExceptionInfo;
-
-    HANDLE hImpersonationToken = NULL;
-    if( !getImpersonationToken( &hImpersonationToken ) )
-        return FALSE;
-
-	// You have to find the right dbghelp.dll. 
-	// Look next to the EXE first since the one in System32 might be old (Win2k)
-	
-	HMODULE hDll = NULL;
-	TCHAR szDbgHelpPath[MAX_PATH];
-
-	if( GetModuleFileName( NULL, m_szAppPath, _MAX_PATH ) )
-	{
-		TCHAR *pSlash = _tcsrchr( m_szAppPath, '\\' );
-
-		if( pSlash )
-		{
-			_tcscpy_s( m_szAppBaseName, pSlash + 1);
-			*(pSlash+1) = 0;
-		}
-
-		_tcscpy_s( szDbgHelpPath, m_szAppPath );
-        _tcscat_s( szDbgHelpPath, _T("DBGHELP.DLL") );
-		hDll = ::LoadLibrary( szDbgHelpPath );
-	}
-
-	if( hDll == NULL )
-	{
-		// If we haven't found it yet - try one more time.
-		hDll = ::LoadLibrary( _T("DBGHELP.DLL") );
-	}
-
-	LPCTSTR szResult = NULL;
-
-	if( hDll )
-	{
-        // Get the address of the MiniDumpWriteDump function, which writes 
-        // user-mode mini-dump information to a specified file.
-		MINIDUMPWRITEDUMP MiniDumpWriteDump = 
-            (MINIDUMPWRITEDUMP)::GetProcAddress( hDll, "MiniDumpWriteDump" );
-
-		if( MiniDumpWriteDump != NULL )
-        {
-			TCHAR szScratch[USER_DATA_BUFFER_SIZE];
-
-			setMiniDumpFileName();
-
-			// Ask the user if he or she wants to save a mini-dump file...
-			_tcssprintf( szScratch,
-                         _T("There was an unexpected error:\n\nWould you ")
-                         _T("like to create a mini-dump file?\n\n%s " ),
-                         m_szMiniDumpPath);
-
-			// Create the mini-dump file...
-			HANDLE hFile = ::CreateFile( m_szMiniDumpPath, 
-                                            GENERIC_WRITE, 
-                                            FILE_SHARE_WRITE, 
-                                            NULL, 
-                                            CREATE_ALWAYS, 
-                                            FILE_ATTRIBUTE_NORMAL, 
-                                            NULL );
-
-			if( hFile != INVALID_HANDLE_VALUE )
-			{
-				_MINIDUMP_EXCEPTION_INFORMATION ExInfo;
-				ExInfo.ThreadId          = ::GetCurrentThreadId();
-				ExInfo.ExceptionPointers = pExceptionInfo;
-				ExInfo.ClientPointers    = NULL;
-
-                // We need the SeDebugPrivilege to be able to run MiniDumpWriteDump
-                TOKEN_PRIVILEGES tp;
-                BOOL bPrivilegeEnabled = enablePrivilege( SE_DEBUG_NAME, hImpersonationToken, &tp );
-
-                BOOL bOk;
-
-                // DBGHELP.dll is not thread-safe, so we need to restrict access...
-                EnterCriticalSection( s_pCriticalSection );
-                {
-					// Write out the mini-dump data to the file...
-                    bOk = MiniDumpWriteDump( GetCurrentProcess(),
-                                                GetCurrentProcessId(),
-                                                hFile,
-                                                MiniDumpNormal,
-                                                &ExInfo,
-                                                NULL,
-                                                NULL );
-                }
-                LeaveCriticalSection( s_pCriticalSection );
-
-                // Restore the privileges when done
-                if( bPrivilegeEnabled )
-	                restorePrivilege( hImpersonationToken, &tp );
-
-                if( bOk )
-				{
-					szResult = NULL;
-					retval = EXCEPTION_EXECUTE_HANDLER;
-				}
-				else
-				{
-					_tcssprintf( szScratch,
-                                    _T("Failed to save the mini-dump file to '%s' (error %d)"),
-                                    m_szMiniDumpPath,
-                                    GetLastError() );
-
-					szResult = szScratch;
-				}
-
-				::CloseHandle( hFile );
-			}
-			else
-			{
-				_tcssprintf( szScratch,
-                                _T("Failed to create the mini-dump file '%s' (error %d)"),
-                                m_szMiniDumpPath,
-                                GetLastError() );
-
-				szResult = szScratch;
-			}
-		}
-		else
-		{
-			szResult = _T( "Call to GetProcAddress failed to find MiniDumpWriteDump. ")
-                       _T("The DBGHELP.DLL is possibly outdated." );
-		}
-	}
-	else
-	{
-		szResult = _T( "Call to LoadLibrary failed to find DBGHELP.DLL." );
-	}
-
-	if( szResult && m_bPromptUserForMiniDump )
-		::MessageBox( NULL, szResult, NULL, MB_OK );
-
-	TerminateProcess( GetCurrentProcess(), 0 );
-
-	return retval;
-}
-

+ 0 - 32
lewaimai_dispatch/wnd/MiniDumper.h

@@ -1,32 +0,0 @@
-#ifndef MINIDUMPER_H
-#define MINIDUMPER_H
-
-#include <windows.h>
-
-class CMiniDumper
-{
-public:
-
-    CMiniDumper(bool bPromptUserForMiniDump);
-    ~CMiniDumper(void);
-
-private:
-
-    static LONG WINAPI unhandledExceptionHandler(struct _EXCEPTION_POINTERS *pExceptionInfo);
-    void setMiniDumpFileName(void);
-    bool getImpersonationToken(HANDLE* phToken);
-    BOOL enablePrivilege(LPCTSTR pszPriv, HANDLE hToken, TOKEN_PRIVILEGES* ptpOld);
-    BOOL restorePrivilege(HANDLE hToken, TOKEN_PRIVILEGES* ptpOld);
-    LONG writeMiniDump(_EXCEPTION_POINTERS *pExceptionInfo);
-
-    _EXCEPTION_POINTERS *m_pExceptionInfo;
-    TCHAR m_szMiniDumpPath[MAX_PATH];
-    TCHAR m_szAppPath[MAX_PATH];
-    TCHAR m_szAppBaseName[MAX_PATH];
-    bool m_bPromptUserForMiniDump;
-
-    static CMiniDumper* s_pMiniDumper;
-    static LPCRITICAL_SECTION s_pCriticalSection;
-};
-
-#endif // MINIDUMPER_H

+ 1 - 1
lewaimai_dispatch/zhipuzi_pos_windows.cpp

@@ -37,7 +37,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
         return 0;
     }
 
-    CGameFrameWnd* pFrame = new CGameFrameWnd();
+    CMainWnd* pFrame = new CMainWnd();
     if(pFrame == NULL)
     {
         return 0;