資源簡介
C++聊天室(MFC實現)
監聽等待那部分的代碼比較難寫。
一開始想用多線程的,發現比較麻煩。
最后用了監聽機制。

代碼片段和文件信息
//?NetChat3.cpp?:?Defines?the?class?behaviors?for?the?application.
//
#include?“stdafx.h“
#include?“NetChat3.h“
#include?“NetChat3Dlg.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CNetChat3App
BEGIN_MESSAGE_MAP(CNetChat3App?CWinApp)
//{{AFX_MSG_MAP(CNetChat3App)
//?NOTE?-?the?ClassWizard?will?add?and?remove?mapping?macros?here.
//????DO?NOT?EDIT?what?you?see?in?these?blocks?of?generated?code!
//}}AFX_MSG
ON_COMMAND(ID_HELP?CWinApp::onhelp)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CNetChat3App?construction
CNetChat3App::CNetChat3App()
{
//?TODO:?add?construction?code?here
//?Place?all?significant?initialization?in?InitInstance
}
/////////////////////////////////////////////////////////////////////////////
//?The?one?and?only?CNetChat3App?object
CNetChat3App?theApp;
/////////////////////////////////////////////////////////////////////////////
//?CNetChat3App?initialization
BOOL?CNetChat3App::InitInstance()
{
AfxEnableControlContainer();
//?Standard?initialization
//?If?you?are?not?using?these?features?and?wish?to?reduce?the?size
//??of?your?final?executable?you?should?remove?from?the?following
//??the?specific?initialization?routines?you?do?not?need.
#ifdef?_AFXDLL
Enable3dControls(); //?Call?this?when?using?MFC?in?a?shared?DLL
#else
Enable3dControlsStatic(); //?Call?this?when?linking?to?MFC?statically
#endif
CNetChat3Dlg?dlg;
m_pMainWnd?=?&dlg;
int?nResponse?=?dlg.DoModal();
if?(nResponse?==?IDOK)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?OK
}
else?if?(nResponse?==?IDCANCEL)
{
//?TODO:?Place?code?here?to?handle?when?the?dialog?is
//??dismissed?with?Cancel
}
//?Since?the?dialog?has?been?closed?return?FALSE?so?that?we?exit?the
//??application?rather?than?start?the?application‘s?message?pump.
return?FALSE;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????613376??2010-01-02?21:05??C++聊天室\3107006706?曾江(網絡實驗報告).doc
?????文件?????127034??2010-01-02?20:23??C++聊天室\NetChat3\Debug\NetChat3.exe
?????文件??????29241??2010-01-02?20:13??C++聊天室\NetChat3\Debug\NetChat3.obj
?????文件?????451584??2010-01-02?20:23??C++聊天室\NetChat3\Debug\NetChat3.pdb
?????文件???????3220??2010-01-02?11:16??C++聊天室\NetChat3\Debug\NetChat3.res
?????文件??????????0??2010-01-02?20:13??C++聊天室\NetChat3\Debug\NetChat3.sbr
?????文件?????100520??2010-01-02?20:23??C++聊天室\NetChat3\Debug\NetChat3Dlg.obj
?????文件??????????0??2010-01-02?20:23??C++聊天室\NetChat3\Debug\NetChat3Dlg.sbr
?????文件?????105419??2010-01-01?17:37??C++聊天室\NetChat3\Debug\StdAfx.obj
?????文件????1369610??2010-01-01?17:37??C++聊天室\NetChat3\Debug\StdAfx.sbr
?????文件?????438272??2010-01-02?20:23??C++聊天室\NetChat3\Debug\vc60.pdb
?????文件??????36404??2010-01-02?11:16??C++聊天室\NetChat3\NetChat3.aps
?????文件???????1760??2010-01-02?20:31??C++聊天室\NetChat3\NetChat3.clw
?????文件???????2091??2010-01-01?08:36??C++聊天室\NetChat3\NetChat3.cpp
?????文件???????4235??2010-01-01?18:45??C++聊天室\NetChat3\NetChat3.dsp
?????文件????????524??2010-01-01?08:03??C++聊天室\NetChat3\NetChat3.dsw
?????文件???????1346??2010-01-01?08:03??C++聊天室\NetChat3\NetChat3.h
?????文件??????66560??2010-01-02?21:03??C++聊天室\NetChat3\NetChat3.ncb
?????文件??????54784??2010-01-02?21:03??C++聊天室\NetChat3\NetChat3.opt
?????文件???????1177??2010-01-02?20:23??C++聊天室\NetChat3\NetChat3.plg
?????文件???????6793??2010-01-02?11:16??C++聊天室\NetChat3\NetChat3.rc
?????文件??????12625??2010-01-02?20:23??C++聊天室\NetChat3\NetChat3Dlg.cpp
?????文件???????2388??2010-01-02?20:13??C++聊天室\NetChat3\NetChat3Dlg.h
?????文件???????3615??2010-01-01?08:03??C++聊天室\NetChat3\ReadMe.txt
?????文件???????1078??2010-01-01?08:03??C++聊天室\NetChat3\res\NetChat3.ico
?????文件????????400??2010-01-01?08:03??C++聊天室\NetChat3\res\NetChat3.rc2
?????文件???????1192??2010-01-02?11:16??C++聊天室\NetChat3\resource.h
?????文件????????210??2010-01-01?08:03??C++聊天室\NetChat3\StdAfx.cpp
?????文件???????1054??2010-01-01?08:03??C++聊天室\NetChat3\StdAfx.h
?????文件?????127034??2010-01-02?20:23??C++聊天室\NetChat3.exe
............此處省略36個文件信息
評論
共有 條評論