acl/lib_fiber/samples/WinEchod/WinEchod.cpp

99 lines
2.4 KiB
C++
Raw Normal View History

// WinEchod.cpp : <20><><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
2018-11-30 14:38:22 +08:00
//
#include "stdafx.h"
#include "WinEchod.h"
#include "WinEchodDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CWinEchodApp
BEGIN_MESSAGE_MAP(CWinEchodApp, CWinApp)
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
END_MESSAGE_MAP()
// CWinEchodApp <20><><EFBFBD><EFBFBD>
2018-11-30 14:38:22 +08:00
CWinEchodApp::CWinEchodApp()
{
// ֧<><D6A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2018-11-30 14:38:22 +08:00
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
// TODO: <20>ڴ˴<DAB4><CBB4><EFBFBD><EFBFBD>ӹ<EFBFBD><D3B9><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ij<EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> InitInstance <20><>
2018-11-30 14:38:22 +08:00
}
// Ψһ<CEA8><D2BB>һ<EFBFBD><D2BB> CWinEchodApp <20><><EFBFBD><EFBFBD>
2018-11-30 14:38:22 +08:00
CWinEchodApp theApp;
// CWinEchodApp <20><>ʼ<EFBFBD><CABC>
2018-11-30 14:38:22 +08:00
BOOL CWinEchodApp::InitInstance()
{
// <20><><EFBFBD><EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> Windows XP <20>ϵ<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD>嵥ָ<E5B5A5><D6B8>Ҫ
// ʹ<><CAB9> ComCtl32.dll <20>汾 6 <20><><EFBFBD><EFBFBD><EFBFBD>߰汾<DFB0><E6B1BE><EFBFBD><EFBFBD><EFBFBD>ÿ<EFBFBD><C3BF>ӻ<EFBFBD><D3BB><EFBFBD>ʽ<EFBFBD><CABD>
//<2F><><EFBFBD><EFBFBD>Ҫ InitCommonControlsEx()<29><><EFBFBD><EFBFBD><EFBFBD>򣬽<EFBFBD><F2A3ACBD>޷<EFBFBD><DEB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڡ<EFBFBD>
2018-11-30 14:38:22 +08:00
INITCOMMONCONTROLSEX InitCtrls;
InitCtrls.dwSize = sizeof(InitCtrls);
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD>õ<EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD>ؼ<EFBFBD><D8BC>
2018-11-30 14:38:22 +08:00
InitCtrls.dwICC = ICC_WIN95_CLASSES;
InitCommonControlsEx(&InitCtrls);
CWinApp::InitInstance();
if (!AfxSocketInit()) {
2018-11-30 14:38:22 +08:00
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
// <20><><EFBFBD><EFBFBD> shell <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Է<EFBFBD><D4B7>Ի<EFBFBD><D4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20>κ<EFBFBD> shell <20><><EFBFBD><EFBFBD>ͼ<EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD> shell <20>б<EFBFBD><D0B1><EFBFBD>ͼ<EFBFBD>ؼ<EFBFBD><D8BC><EFBFBD>
2018-11-30 14:38:22 +08:00
CShellManager *pShellManager = new CShellManager;
// <20><><EFBFBD>Windows Native<76><65><EFBFBD>Ӿ<EFBFBD><D3BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><D4B1><EFBFBD> MFC <20>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2018-11-30 14:38:22 +08:00
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
// <20><>׼<EFBFBD><D7BC>ʼ<EFBFBD><CABC>
// <20><><EFBFBD><EFBFBD>δʹ<CEB4><CAB9><EFBFBD><EFBFBD>Щ<EFBFBD><D0A9><EFBFBD>ܲ<EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD>С
// <20><><EFBFBD>տ<EFBFBD>ִ<EFBFBD><D6B4><EFBFBD>ļ<EFBFBD><C4BC>Ĵ<EFBFBD>С<EFBFBD><D0A1><EFBFBD><EFBFBD>Ӧ<EFBFBD>Ƴ<EFBFBD><C6B3><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ض<EFBFBD><D8B6><EFBFBD>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ洢<DAB4><E6B4A2><EFBFBD>õ<EFBFBD>ע<EFBFBD><D7A2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
// TODO: Ӧ<>ʵ<EFBFBD><CAB5>޸ĸ<DEB8><C4B8>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD>޸<EFBFBD>Ϊ<EFBFBD><CEAA>˾<EFBFBD><CBBE><EFBFBD><EFBFBD>֯<EFBFBD><D6AF>
SetRegistryKey(_T("Ӧ<EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɵı<EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><EFBFBD><EFBFBD>"));
2018-11-30 14:38:22 +08:00
CWinEchodDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK) {
// TODO: <20>ڴ˷<DAB4><CBB7>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
// <20><>ȷ<EFBFBD><C8B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رնԻ<D5B6><D4BB><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
} else if (nResponse == IDCANCEL) {
// TODO: <20>ڴ˷<DAB4><CBB7>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
// <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>رնԻ<D5B6><D4BB><EFBFBD><EFBFBD>Ĵ<EFBFBD><C4B4><EFBFBD>
} else if (nResponse == -1) {
TRACE(traceAppMsg, 0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20>Ի<EFBFBD><D4BB>򴴽<EFBFBD>ʧ<EFBFBD>ܣ<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֹ<EFBFBD><D6B9>\n");
TRACE(traceAppMsg, 0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶԻ<DAB6><D4BB><EFBFBD><EFBFBD><EFBFBD>ʹ<EFBFBD><CAB9> MFC <20>ؼ<EFBFBD><D8BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>޷<EFBFBD> #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS<47><53>\n");
2018-11-30 14:38:22 +08:00
}
// ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><E6B4B4><EFBFBD><EFBFBD> shell <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (pShellManager != NULL) {
2018-11-30 14:38:22 +08:00
delete pShellManager;
}
// <20><><EFBFBD>ڶԻ<DAB6><D4BB><EFBFBD><EFBFBD>ѹرգ<D8B1><D5A3><EFBFBD><EFBFBD>Խ<EFBFBD><D4BD><EFBFBD><EFBFBD><EFBFBD> FALSE <20>Ա<EFBFBD><D4B1>˳<EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD>
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӧ<EFBFBD>ó<EFBFBD><C3B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>á<EFBFBD>
2018-11-30 14:38:22 +08:00
return FALSE;
}