Bladeren bron

继续调试退出登陆的问题

张洋 5 jaren geleden
bovenliggende
commit
a6d91f1590

BIN
lib/debug/zpzDll.lib


+ 2 - 4
zhipuzi_pay_plugin/wnd/CLoginWnd.cpp

@@ -572,11 +572,9 @@ void CLoginWnd::LoginSuccess()
     pFrame->SetIcon(IDI_ICON_DUILIB);
     pFrame->Create(NULL, _T("智铺子收银插件金额"), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW, 0, 0, 0, 0);
 
-    Close();
+	pFrame->ShowWindow(true);
 
-	UINT ret = pFrame->ShowModal();
-	
-	int a = 1;
+	Close();
 }
 
 void CLoginWnd::LoginError()

+ 1 - 1
zhipuzi_pay_plugin/wnd/CLoginWnd.h

@@ -22,7 +22,7 @@ public:
 
     void OnFinalMessage(HWND /*hWnd*/)
     {
-        //m_pm.RemovePreMessageFilter(this);
+        m_pm.RemovePreMessageFilter(this);
         delete this;
     };
 

+ 1 - 1
zhipuzi_pay_plugin/wnd/CMenuWnd.h

@@ -20,7 +20,7 @@ public:
 
 	void OnFinalMessage(HWND /*hWnd*/)
 	{
-		//m_pm.RemovePreMessageFilter(this);
+		m_pm.RemovePreMessageFilter(this);
 		//delete this;
 	};
 

+ 30 - 0
zhipuzi_pay_plugin/wnd/CSystemSettingWnd.cpp

@@ -460,6 +460,30 @@ LRESULT CSystemSettingWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOO
     return 0;
 }
 
+LRESULT CSystemSettingWnd::OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	bHandled = FALSE;
+	return 0;
+}
+
+/*
+ *这个是窗口被销毁的时候调用的
+ **/
+LRESULT CSystemSettingWnd::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	bHandled = FALSE;
+	return 0;
+}
+
+LRESULT CSystemSettingWnd::OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
+{
+	if (::IsIconic(*this))
+	{
+		bHandled = FALSE;
+	}
+	return (wParam == 0) ? TRUE : FALSE;
+}
+
 LRESULT CSystemSettingWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 {
     POINT pt;
@@ -621,6 +645,12 @@ LRESULT CSystemSettingWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam
     case WM_CREATE:
         lRes = OnCreate(uMsg, wParam, lParam, bHandled);
         break;
+	case WM_CLOSE:
+		lRes = OnClose(uMsg, wParam, lParam, bHandled);
+		break;
+	case WM_DESTROY:
+		lRes = OnDestroy(uMsg, wParam, lParam, bHandled);
+		break;
     case WM_NCACTIVATE:
         lRes = OnNcActivate(uMsg, wParam, lParam, bHandled);
         break;

+ 5 - 8
zhipuzi_pay_plugin/wnd/CSystemSettingWnd.h

@@ -48,14 +48,11 @@ public:
 
 	LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 
-	LRESULT OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-	{
-		if (::IsIconic(*this))
-		{
-			bHandled = FALSE;
-		}
-		return (wParam == 0) ? TRUE : FALSE;
-	}
+	LRESULT OnClose(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
+
+	LRESULT OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 
 	LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
 	{

+ 4 - 0
zhipuzi_pay_plugin/wnd/CValueWnd.cpp

@@ -1095,6 +1095,10 @@ void CValueWnd::Logout()
 
 void CValueWnd::QuitApp()
 {
+	pMenu->Close();
+
+	this->Close();
+
 	//直接退出整个程序
 	PostQuitMessage(0);
 }

+ 6 - 0
zhipuzi_pay_plugin/wnd/CValueWnd.h

@@ -64,8 +64,14 @@ public:
 
 	LRESULT OnWatchWndUpdate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 
+	/*
+	 *这个是消息到达窗口过程之后的逻辑
+	 **/
 	LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
 
+	/*
+	 *这个是消息到达窗口过程之前的过滤
+	*/
 	LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);
 
 	//显示收款界面

+ 0 - 103
zhipuzi_pay_plugin/wnd/CWaimaiOrderFailReasonWnd.cpp

@@ -1,103 +0,0 @@
-#include "../pch/pch.h"
-#include "CWaimaiOrderFailReasonWnd.h"
-
-LRESULT CWaimaiOrderFailReasonWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-{
-    POINT pt;
-    pt.x = GET_X_LPARAM(lParam);
-    pt.y = GET_Y_LPARAM(lParam);
-    ::ScreenToClient(*this, &pt);
-
-    RECT rcClient;
-    ::GetClientRect(*this, &rcClient);
-
-    RECT rcCaption = m_pm.GetCaptionRect();
-    if(pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.right - rcCaption.right \
-            && pt.y >= rcCaption.top && pt.y < rcCaption.bottom)
-    {
-        CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(pt));
-        if(pControl && _tcscmp(pControl->GetClass(), DUI_CTR_BUTTON) != 0)
-        {
-            return HTCAPTION;
-        }
-    }
-
-    return HTCLIENT;
-}
-
-LRESULT CWaimaiOrderFailReasonWnd::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-{
-    SIZE szRoundCorner = m_pm.GetRoundCorner();
-    if(!::IsIconic(*this) && (szRoundCorner.cx != 0 || szRoundCorner.cy != 0))
-    {
-        CDuiRect rcWnd;
-        ::GetWindowRect(*this, &rcWnd);
-        rcWnd.Offset(-rcWnd.left, -rcWnd.top);
-        rcWnd.right++;
-        rcWnd.bottom++;
-        HRGN hRgn = ::CreateRoundRectRgn(rcWnd.left, rcWnd.top, rcWnd.right, rcWnd.bottom, szRoundCorner.cx, szRoundCorner.cy);
-        ::SetWindowRgn(*this, hRgn, TRUE);
-        ::DeleteObject(hRgn);
-    }
-
-    bHandled = FALSE;
-    return 0;
-}
-
-LRESULT CWaimaiOrderFailReasonWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
-    LRESULT lRes = 0;
-    BOOL bHandled = TRUE;
-    switch(uMsg)
-    {
-    case WM_CREATE:
-        lRes = OnCreate(uMsg, wParam, lParam, bHandled);
-        break;
-    case WM_NCACTIVATE:
-        lRes = OnNcActivate(uMsg, wParam, lParam, bHandled);
-        break;
-    case WM_NCCALCSIZE:
-        lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled);
-        break;
-    case WM_NCPAINT:
-        lRes = OnNcPaint(uMsg, wParam, lParam, bHandled);
-        break;
-    case WM_NCHITTEST:
-        lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled);
-        break;
-    case WM_SIZE:
-        lRes = OnSize(uMsg, wParam, lParam, bHandled);
-        break;
-    default:
-        bHandled = FALSE;
-    }
-    if(bHandled)
-    {
-        return lRes;
-    }
-    if(m_pm.MessageHandler(uMsg, wParam, lParam, lRes))
-    {
-        return lRes;
-    }
-    return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
-}
-
-LRESULT CWaimaiOrderFailReasonWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled)
-{
-    if(uMsg == WM_KEYDOWN)
-    {
-        if(wParam == VK_RETURN)
-        {
-            return true;
-        }
-        else if(wParam == VK_ESCAPE)
-        {
-            return true;
-        }
-    }
-    return false;
-}
-
-
-
-

+ 0 - 120
zhipuzi_pay_plugin/wnd/CWaimaiOrderFailReasonWnd.h

@@ -1,120 +0,0 @@
-#pragma once
-
-#include "../pch/pch.h"
-
-class CWaimaiOrderFailReasonWnd : public CWindowWnd, public INotifyUI, public IMessageFilterUI
-{
-public:
-    LPCTSTR GetWindowClassName() const
-    {
-        return _T("UIWaimaiOrderFailFrame");
-    };
-
-    UINT GetClassStyle() const
-    {
-        return UI_CLASSSTYLE_DIALOG;
-    };
-
-    void OnFinalMessage(HWND /*hWnd*/)
-    {
-        //WindowImplBase::OnFinalMessage(hWnd);
-        m_pm.RemovePreMessageFilter(this);
-
-        //delete this;
-    };
-
-    void Init()
-    {
-
-    }
-
-    std::string getReason()
-    {
-        return m_reason;
-    }
-
-    void Notify(TNotifyUI& msg)
-    {
-        if(msg.sType == _T("click"))
-        {
-            DuiLib::CDuiString senderName = msg.pSender->GetName();
-
-            if(senderName == _T("waimai_order_fail_dlg_closebtn"))
-            {
-                Close(IDCANCEL);
-                return;
-            }
-            else if(senderName == _T("waimai_order_fail_dlg_save"))
-            {
-                //开始保存厨房打印机的数据
-                CEditUI* pReason = static_cast<CEditUI*>(m_pm.FindControl(_T("waimai_order_fail_dlg_reason")));
-                wstring wsReason = pReason->GetText();
-
-                m_reason = CLewaimaiString::UnicodeToUTF8(wsReason);
-
-                Close(IDOK);
-                return;
-            }
-        }
-    }
-
-    LRESULT OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-    {
-        LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
-        styleValue &= ~WS_CAPTION;
-        ::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
-
-        // 把自己的窗口句柄与窗口绘制管理器挂接在一起
-        m_pm.Init(m_hWnd);
-
-        m_pm.AddPreMessageFilter(this);
-
-        CDialogBuilder builder;
-
-        CControlUI* pRoot = builder.Create(_T("waimai_order_fail_reason_dlg.xml"), (UINT)0, NULL, &m_pm);
-        ASSERT(pRoot && "Failed to parse XML");
-
-        // 把这些控件绘制到本窗口上
-        m_pm.AttachDialog(pRoot);
-
-        // 把自己加入到CPaintManagerUI的m_aNotifiers数组中,用于处理Notify函数
-        m_pm.AddNotifier(this);
-
-        Init();
-
-        return 0;
-    }
-
-    LRESULT OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-    {
-        if(::IsIconic(*this))
-        {
-            bHandled = FALSE;
-        }
-        return (wParam == 0) ? TRUE : FALSE;
-    }
-
-    LRESULT OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-    {
-        return 0;
-    }
-
-    LRESULT OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-    {
-        return 0;
-    }
-
-    LRESULT OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-
-    LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-
-    LRESULT HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam);
-
-    LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled);
-
-public:
-    CPaintManagerUI m_pm;
-
-    std::string m_reason;
-};
-

+ 2 - 2
zhipuzi_pay_plugin/zhipuzi_pay_plugin.cpp

@@ -43,11 +43,11 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
     pLogin->SetIcon(IDI_ICON_DUILIB);
     pLogin->CenterWindow();
 
-    pLogin->ShowModal();
+	pLogin->ShowWindow(true);
 
     CPaintManagerUI::MessageLoop();
 
-    ::CoUninitialize();
+     ::CoUninitialize();
 
     return 0;
 }

+ 0 - 2
zhipuzi_pay_plugin/zhipuzi_pay_plugin.vcxproj

@@ -246,7 +246,6 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClInclude Include="wnd\CValueWnd.h" />
     <ClInclude Include="wnd\CMessageboxWnd.h" />
     <ClInclude Include="wnd\CUpdateWnd.h" />
-    <ClInclude Include="wnd\CWaimaiOrderFailReasonWnd.h" />
     <ClInclude Include="control\CSettingUI.h" />
     <ClInclude Include="tool\CSetting.h" />
     <ClInclude Include="tool\CSqlite3.h" />
@@ -289,7 +288,6 @@ copy $(ProjectDir)conf\ $(SolutionDir)bin\$(Platform)\$(Configuration)\conf\</Co
     <ClCompile Include="wnd\CValueWnd.cpp" />
     <ClCompile Include="wnd\CMessageboxWnd.cpp" />
     <ClCompile Include="wnd\CUpdateWnd.cpp" />
-    <ClCompile Include="wnd\CWaimaiOrderFailReasonWnd.cpp" />
     <ClCompile Include="control\CSettingUI.cpp" />
     <ClCompile Include="tool\CSetting.cpp" />
     <ClCompile Include="tool\CSqlite3.cpp" />

+ 0 - 6
zhipuzi_pay_plugin/zhipuzi_pay_plugin.vcxproj.filters

@@ -69,9 +69,6 @@
     <ClInclude Include="tool\CSetting.h">
       <Filter>头文件</Filter>
     </ClInclude>
-    <ClInclude Include="wnd\CWaimaiOrderFailReasonWnd.h">
-      <Filter>头文件</Filter>
-    </ClInclude>
     <ClInclude Include="wnd\CUpdateWnd.h">
       <Filter>头文件</Filter>
     </ClInclude>
@@ -194,9 +191,6 @@
     <ClCompile Include="tool\CSetting.cpp">
       <Filter>源文件</Filter>
     </ClCompile>
-    <ClCompile Include="wnd\CWaimaiOrderFailReasonWnd.cpp">
-      <Filter>源文件</Filter>
-    </ClCompile>
     <ClCompile Include="wnd\CUpdateWnd.cpp">
       <Filter>源文件</Filter>
     </ClCompile>