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())
|
||||
{
|
||||
ShowWindow(SW_NORMAL);
|
||||
ShowWindow(SW_SHOW);
|
||||
break;
|
||||
}
|
||||
ShowWindow(IsWindowVisible() ? SW_HIDE : SW_SHOWNORMAL);
|
||||
ShowWindow(IsWindowVisible() ? SW_HIDE : SW_SHOW);
|
||||
SetForegroundWindow();
|
||||
break;
|
||||
}
|
||||
@@ -431,7 +431,10 @@ BOOL CMy2015RemoteDlg::OnInitDialog()
|
||||
|
||||
CreateSolidMenu();
|
||||
|
||||
ListenPort();
|
||||
if (!ListenPort()) {
|
||||
OnCancel();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if !INDEPENDENT
|
||||
ShowWindow(SW_SHOW);
|
||||
@@ -571,6 +574,13 @@ void CMy2015RemoteDlg::OnTimer(UINT_PTR nIDEvent)
|
||||
|
||||
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;
|
||||
ShowWindow(SW_HIDE);
|
||||
#if INDEPENDENT
|
||||
@@ -620,7 +630,6 @@ void CMy2015RemoteDlg::OnClose()
|
||||
m_iocpServer = NULL;
|
||||
}
|
||||
timeEndPeriod(1);
|
||||
CDialogEx::OnClose();
|
||||
}
|
||||
|
||||
|
||||
@@ -836,13 +845,15 @@ VOID CMy2015RemoteDlg::OnAbout()
|
||||
//<2F><><EFBFBD><EFBFBD>Menu
|
||||
void CMy2015RemoteDlg::OnNotifyShow()
|
||||
{
|
||||
ShowWindow(SW_SHOW);
|
||||
BOOL v= IsWindowVisible();
|
||||
ShowWindow(v? SW_HIDE : SW_SHOW);
|
||||
}
|
||||
|
||||
|
||||
void CMy2015RemoteDlg::OnNotifyExit()
|
||||
{
|
||||
SendMessage(WM_CLOSE);
|
||||
Release();
|
||||
CDialogEx::OnOK(); // <20>رնԻ<D5B6><D4BB><EFBFBD>
|
||||
}
|
||||
|
||||
|
||||
@@ -857,11 +868,11 @@ void CMy2015RemoteDlg::OnMainSet()
|
||||
|
||||
void CMy2015RemoteDlg::OnMainExit()
|
||||
{
|
||||
// TODO: <20>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EEB4A6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
SendMessage(WM_CLOSE);
|
||||
Release();
|
||||
CDialogEx::OnOK(); // <20>رնԻ<D5B6><D4BB><EFBFBD>
|
||||
}
|
||||
|
||||
VOID CMy2015RemoteDlg::ListenPort()
|
||||
BOOL CMy2015RemoteDlg::ListenPort()
|
||||
{
|
||||
int nPort = ((CMy2015RemoteApp*)AfxGetApp())->m_iniFile.GetInt("settings", "ghost");
|
||||
//<2F><>ȡini <20>ļ<EFBFBD><C4BC>еļ<D0B5><C4BC><EFBFBD><EFBFBD>˿<EFBFBD>
|
||||
@@ -871,11 +882,11 @@ VOID CMy2015RemoteDlg::ListenPort()
|
||||
nPort = 6543;
|
||||
if (nMaxConnection <= 0)
|
||||
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>
|
||||
UINT ret = 0;
|
||||
@@ -885,11 +896,15 @@ VOID CMy2015RemoteDlg::Activate(int nPort,int nMaxConnection)
|
||||
char code[32];
|
||||
sprintf_s(code, "%d", ret);
|
||||
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;
|
||||
strTemp.Format("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>: %d<>ɹ<EFBFBD>", nPort);
|
||||
ShowMessage(true,strTemp);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -53,8 +53,8 @@ public:
|
||||
VOID CreateToolBar();
|
||||
VOID CreateNotifyBar();
|
||||
VOID CreateSolidMenu();
|
||||
VOID ListenPort();
|
||||
VOID Activate(int nPort,int nMaxConnection);
|
||||
BOOL ListenPort();
|
||||
BOOL Activate(int nPort,int nMaxConnection);
|
||||
|
||||
static VOID CALLBACK NotifyProc(CONTEXT_OBJECT* ContextObject);
|
||||
static VOID CALLBACK OfflineProc(CONTEXT_OBJECT* ContextObject);
|
||||
@@ -75,6 +75,7 @@ public:
|
||||
CBitmap m_bmOnline[3];
|
||||
afx_msg void OnTimer(UINT_PTR nIDEvent);
|
||||
afx_msg void OnClose();
|
||||
void Release();
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
afx_msg void OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnOnlineMessage();
|
||||
|
||||
Reference in New Issue
Block a user