|
|
@@ -2,15 +2,10 @@
|
|
|
#include "CValueWnd.h"
|
|
|
|
|
|
#include "../tool/CComHelper.h"
|
|
|
-
|
|
|
#include "../tool/CSerialPort.h"
|
|
|
-
|
|
|
#include "../helper/CBitmapHelper.h"
|
|
|
-
|
|
|
#include "../network/CMessagePush.h"
|
|
|
|
|
|
-#include <atltypes.h>
|
|
|
-
|
|
|
#include "CLoginWnd.h"
|
|
|
|
|
|
void CValueWnd::Notify(TNotifyUI& msg)
|
|
|
@@ -897,36 +892,16 @@ void CValueWnd::ShowSystemSetting()
|
|
|
pSystemSettingFrame->Create(NULL, _T(""), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW);
|
|
|
pSystemSettingFrame->SetIcon(IDI_ICON_DUILIB);
|
|
|
pSystemSettingFrame->CenterWindow();
|
|
|
- UINT ret = pSystemSettingFrame->ShowModal();
|
|
|
-
|
|
|
- int a = 1;
|
|
|
-
|
|
|
- if (ret == IDOK)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
- else if (ret == IDCANCEL)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if (pSystemSettingFrame->m_is_logout)
|
|
|
- {
|
|
|
- //这个表示是通过退出登录关闭的
|
|
|
-
|
|
|
- delete pSystemSettingFrame;
|
|
|
-
|
|
|
- Logout();
|
|
|
+ pSystemSettingFrame->ShowWindow(true);
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
- int a = 1;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- delete pSystemSettingFrame;
|
|
|
+void CValueWnd::CloseSystemSetting()
|
|
|
+{
|
|
|
+ m_is_show_setting = false;
|
|
|
|
|
|
- m_is_show_setting = false;
|
|
|
- }
|
|
|
- }
|
|
|
+ m_settingWnd->Close();
|
|
|
+ m_settingWnd = NULL;
|
|
|
}
|
|
|
|
|
|
void CValueWnd::ShowJiaoyijilu()
|
|
|
@@ -1041,8 +1016,12 @@ void CValueWnd::ShowJiaoban()
|
|
|
|
|
|
void CValueWnd::Logout()
|
|
|
{
|
|
|
- //先做一些清理工作
|
|
|
+ //先正常关闭设置窗口
|
|
|
+ m_is_show_setting = false;
|
|
|
+ m_settingWnd->Close();
|
|
|
+ m_settingWnd = NULL;
|
|
|
|
|
|
+ //先做一些清理工作
|
|
|
m_is_quit = true;
|
|
|
|
|
|
//取消注册的快捷键
|
|
|
@@ -1053,19 +1032,14 @@ void CValueWnd::Logout()
|
|
|
|
|
|
//注意这里不能delete,这个对象会delete自己
|
|
|
m_push->Stop();
|
|
|
- delete m_push;
|
|
|
|
|
|
pMenu->Close();
|
|
|
- delete pMenu;
|
|
|
|
|
|
pDingweiWnd->Close();
|
|
|
- delete pDingweiWnd;
|
|
|
|
|
|
pDingweiInfoWnd->Close();
|
|
|
- delete pDingweiInfoWnd;
|
|
|
|
|
|
pOcrWnd->Close();
|
|
|
- delete pOcrWnd;
|
|
|
|
|
|
//注销Hook
|
|
|
UninstallHook();
|
|
|
@@ -1073,30 +1047,53 @@ void CValueWnd::Logout()
|
|
|
//暂停数据监控
|
|
|
StopWatch();
|
|
|
|
|
|
+ this->Close();
|
|
|
+
|
|
|
+ //退出登录,取消自动登录
|
|
|
CSetting::SetParam("setting_is_auto_login", "0", true);
|
|
|
- CLoginWnd* pLogin = new CLoginWnd();
|
|
|
|
|
|
+ //创建登录窗口
|
|
|
+ CLoginWnd* pLogin = new CLoginWnd();
|
|
|
if (pLogin == NULL)
|
|
|
{
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- //设置模式
|
|
|
pLogin->Create(NULL, _T("智铺子收银插件登录"), UI_WNDSTYLE_DIALOG, WS_EX_TOOLWINDOW, 0, 0, 0, 0, NULL);
|
|
|
pLogin->SetIcon(IDI_ICON_DUILIB);
|
|
|
pLogin->CenterWindow();
|
|
|
|
|
|
- ::ShowWindow(*pLogin, SW_SHOWNORMAL);
|
|
|
-
|
|
|
- Close();
|
|
|
-
|
|
|
- int a = 1;
|
|
|
+ pLogin->ShowWindow(true);
|
|
|
}
|
|
|
|
|
|
void CValueWnd::QuitApp()
|
|
|
{
|
|
|
+ //先做一些清理工作
|
|
|
+ m_is_quit = true;
|
|
|
+
|
|
|
+ //取消注册的快捷键
|
|
|
+ UnregisterHotKey(m_hWnd, WM_MYHOTKEY_SHOUKUAN);
|
|
|
+
|
|
|
+ //删除右下角的托盘
|
|
|
+ Shell_NotifyIcon(NIM_DELETE, &m_trayIcon);
|
|
|
+
|
|
|
+ //注意这里不能delete,这个对象会delete自己
|
|
|
+ m_push->Stop();
|
|
|
+
|
|
|
pMenu->Close();
|
|
|
|
|
|
+ pDingweiWnd->Close();
|
|
|
+
|
|
|
+ pDingweiInfoWnd->Close();
|
|
|
+
|
|
|
+ pOcrWnd->Close();
|
|
|
+
|
|
|
+ //注销Hook
|
|
|
+ UninstallHook();
|
|
|
+
|
|
|
+ //暂停数据监控
|
|
|
+ StopWatch();
|
|
|
+
|
|
|
this->Close();
|
|
|
|
|
|
//直接退出整个程序
|
|
|
@@ -1214,40 +1211,19 @@ void CValueWnd::UpdateKexian(const char* data, int length)
|
|
|
|
|
|
void CValueWnd::InitWndPos()
|
|
|
{
|
|
|
- ASSERT(::IsWindow(m_hWnd));
|
|
|
- ASSERT((GetWindowStyle(m_hWnd)&WS_CHILD) == 0);
|
|
|
- RECT rcDlg = { 0 };
|
|
|
- ::GetWindowRect(m_hWnd, &rcDlg);
|
|
|
- RECT rcArea = { 0 };
|
|
|
- RECT rcCenter = { 0 };
|
|
|
- HWND hWnd = *this;
|
|
|
- HWND hWndParent = ::GetParent(m_hWnd);
|
|
|
- HWND hWndCenter = ::GetWindowOwner(m_hWnd);
|
|
|
-
|
|
|
- if(hWndCenter != NULL)
|
|
|
- {
|
|
|
- hWnd = hWndCenter;
|
|
|
- }
|
|
|
+ ASSERT(::IsWindow(m_hWnd));
|
|
|
+ ASSERT((GetWindowStyle(m_hWnd)&WS_CHILD) == 0);
|
|
|
|
|
|
- // 处理多显示器模式下屏幕居中
|
|
|
- MONITORINFO oMonitor = {};
|
|
|
- oMonitor.cbSize = sizeof(oMonitor);
|
|
|
- ::GetMonitorInfo(::MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST), &oMonitor);
|
|
|
- rcArea = oMonitor.rcWork;
|
|
|
+ RECT rcDlg = { 0 };
|
|
|
+ ::GetWindowRect(m_hWnd, &rcDlg);
|
|
|
|
|
|
- if(hWndCenter == NULL)
|
|
|
- {
|
|
|
- rcCenter = rcArea;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ::GetWindowRect(hWndCenter, &rcCenter);
|
|
|
- }
|
|
|
+ int DlgWidth = rcDlg.right - rcDlg.left;
|
|
|
+ int DlgHeight = rcDlg.bottom - rcDlg.top;
|
|
|
|
|
|
- int DlgWidth = rcDlg.right - rcDlg.left;
|
|
|
- int DlgHeight = rcDlg.bottom - rcDlg.top;
|
|
|
+ RECT rcArea = { 0 };
|
|
|
+ ::GetWindowRect(::GetDesktopWindow(), &rcArea);
|
|
|
|
|
|
- int xLeft = rcCenter.right - DlgWidth - 60;
|
|
|
+ int xLeft = rcArea.right - DlgWidth - 60;
|
|
|
int yTop = 100;
|
|
|
|
|
|
if(xLeft < rcArea.left)
|