improve: Click close button to hide application
This commit is contained in:
@@ -198,10 +198,10 @@ void CMy2015RemoteDlg::OnIconNotify(WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
if (IsIconic())
|
if (IsIconic())
|
||||||
{
|
{
|
||||||
ShowWindow(SW_NORMAL);
|
ShowWindow(SW_SHOW);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ShowWindow(IsWindowVisible() ? SW_HIDE : SW_SHOWNORMAL);
|
ShowWindow(IsWindowVisible() ? SW_HIDE : SW_SHOW);
|
||||||
SetForegroundWindow();
|
SetForegroundWindow();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -431,7 +431,10 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
|
|||||||
|
|
||||||
CreateSolidMenu();
|
CreateSolidMenu();
|
||||||
|
|
||||||
ListenPort();
|
if (!ListenPort()) {
|
||||||
|
OnCancel();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
#if !INDEPENDENT
|
#if !INDEPENDENT
|
||||||
ShowWindow(SW_SHOW);
|
ShowWindow(SW_SHOW);
|
||||||
@@ -571,6 +574,13 @@ void CMy2015RemoteDlg::OnTimer(UINT_PTR nIDEvent)
|
|||||||
|
|
||||||
void CMy2015RemoteDlg::OnClose()
|
void CMy2015RemoteDlg::OnClose()
|
||||||
{
|
{
|
||||||
|
// <20><><EFBFBD>ش<EFBFBD><D8B4>ڶ<EFBFBD><DAB6><EFBFBD><EFBFBD>ǹر<C7B9>
|
||||||
|
ShowWindow(SW_HIDE);
|
||||||
|
OutputDebugStringA("======> Hide\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
void CMy2015RemoteDlg::Release(){
|
||||||
|
OutputDebugStringA("======> Release\n");
|
||||||
isClosed = TRUE;
|
isClosed = TRUE;
|
||||||
ShowWindow(SW_HIDE);
|
ShowWindow(SW_HIDE);
|
||||||
#if INDEPENDENT
|
#if INDEPENDENT
|
||||||
@@ -620,7 +630,6 @@ void CMy2015RemoteDlg::OnClose()
|
|||||||
m_iocpServer = NULL;
|
m_iocpServer = NULL;
|
||||||
}
|
}
|
||||||
timeEndPeriod(1);
|
timeEndPeriod(1);
|
||||||
CDialogEx::OnClose();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -836,13 +845,15 @@ VOID CMy2015RemoteDlg::OnAbout()
|
|||||||
//<2F><><EFBFBD><EFBFBD>Menu
|
//<2F><><EFBFBD><EFBFBD>Menu
|
||||||
void CMy2015RemoteDlg::OnNotifyShow()
|
void CMy2015RemoteDlg::OnNotifyShow()
|
||||||
{
|
{
|
||||||
ShowWindow(SW_SHOW);
|
BOOL v= IsWindowVisible();
|
||||||
|
ShowWindow(v? SW_HIDE : SW_SHOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CMy2015RemoteDlg::OnNotifyExit()
|
void CMy2015RemoteDlg::OnNotifyExit()
|
||||||
{
|
{
|
||||||
SendMessage(WM_CLOSE);
|
Release();
|
||||||
|
CDialogEx::OnOK(); // <20>رնԻ<D5B6><D4BB><EFBFBD>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -857,11 +868,11 @@ void CMy2015RemoteDlg::OnMainSet()
|
|||||||
|
|
||||||
void CMy2015RemoteDlg::OnMainExit()
|
void CMy2015RemoteDlg::OnMainExit()
|
||||||
{
|
{
|
||||||
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
Release();
|
||||||
SendMessage(WM_CLOSE);
|
CDialogEx::OnOK(); // <20>رնԻ<D5B6><D4BB><EFBFBD>
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID CMy2015RemoteDlg::ListenPort()
|
BOOL CMy2015RemoteDlg::ListenPort()
|
||||||
{
|
{
|
||||||
int nPort = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost");
|
int nPort = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost");
|
||||||
//<2F><>ȡini <20>ļ<EFBFBD><C4BC>еļ<D0B5><C4BC><EFBFBD><EFBFBD>˿<EFBFBD>
|
//<2F><>ȡini <20>ļ<EFBFBD><C4BC>еļ<D0B5><C4BC><EFBFBD><EFBFBD>˿<EFBFBD>
|
||||||
@@ -871,11 +882,11 @@ VOID CMy2015RemoteDlg::ListenPort()
|
|||||||
nPort = 6543;
|
nPort = 6543;
|
||||||
if (nMaxConnection <= 0)
|
if (nMaxConnection <= 0)
|
||||||
nMaxConnection = 10000;
|
nMaxConnection = 10000;
|
||||||
Activate(nPort,nMaxConnection); //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
return Activate(nPort,nMaxConnection); //<2F><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection)
|
BOOL CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection)
|
||||||
{
|
{
|
||||||
m_iocpServer = new IOCPServer; //<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
m_iocpServer = new IOCPServer; //<2F><>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǵ<EFBFBD><C7B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||||
UINT ret = 0;
|
UINT ret = 0;
|
||||||
@@ -885,11 +896,15 @@ VOID CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection)
|
|||||||
char code[32];
|
char code[32];
|
||||||
sprintf_s(code, "%d", ret);
|
sprintf_s(code, "%d", ret);
|
||||||
MessageBox("<EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD>StartServerʧ<EFBFBD><EFBFBD>! <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:"+CString(code));
|
MessageBox("<EFBFBD><EFBFBD><EFBFBD>ú<EFBFBD><EFBFBD><EFBFBD>StartServerʧ<EFBFBD><EFBFBD>! <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:"+CString(code));
|
||||||
|
delete m_iocpServer;
|
||||||
|
m_iocpServer = NULL;
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
CString strTemp;
|
CString strTemp;
|
||||||
strTemp.Format("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>: %d<>ɹ<EFBFBD>", nPort);
|
strTemp.Format("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>: %d<>ɹ<EFBFBD>", nPort);
|
||||||
ShowMessage(true,strTemp);
|
ShowMessage(true,strTemp);
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ public:
|
|||||||
VOID CreateToolBar();
|
VOID CreateToolBar();
|
||||||
VOID CreateNotifyBar();
|
VOID CreateNotifyBar();
|
||||||
VOID CreateSolidMenu();
|
VOID CreateSolidMenu();
|
||||||
VOID ListenPort();
|
BOOL ListenPort();
|
||||||
VOID Activate(int nPort,int nMaxConnection);
|
BOOL Activate(int nPort,int nMaxConnection);
|
||||||
|
|
||||||
static VOID CALLBACK NotifyProc(CONTEXT_OBJECT* ContextObject);
|
static VOID CALLBACK NotifyProc(CONTEXT_OBJECT* ContextObject);
|
||||||
static VOID CALLBACK OfflineProc(CONTEXT_OBJECT* ContextObject);
|
static VOID CALLBACK OfflineProc(CONTEXT_OBJECT* ContextObject);
|
||||||
@@ -75,6 +75,7 @@ public:
|
|||||||
CBitmap m_bmOnline[3];
|
CBitmap m_bmOnline[3];
|
||||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||||
afx_msg void OnClose();
|
afx_msg void OnClose();
|
||||||
|
void Release();
|
||||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||||
afx_msg void OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult);
|
afx_msg void OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult);
|
||||||
afx_msg void OnOnlineMessage();
|
afx_msg void OnOnlineMessage();
|
||||||
|
|||||||
Reference in New Issue
Block a user