資源簡介
這是一個基于mfc的windows socket 編寫的網絡聊天小程序的源代碼。可運行,環境為VC++6.0。

代碼片段和文件信息
//?Chat.cpp?:?Defines?the?class?behaviors?for?the?application.
//
#include?“stdafx.h“
#include?“Chat.h“
#include?“ChatDlg.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CChatApp
BEGIN_MESSAGE_MAP(CChatApp?CWinApp)
//{{AFX_MSG_MAP(CChatApp)
//?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()
/////////////////////////////////////////////////////////////////////////////
//?CChatApp?construction
CChatApp::CChatApp()
{
//?TODO:?add?construction?code?here
//?Place?all?significant?initialization?in?InitInstance
}
/////////////////////////////////////////////////////////////////////////////
//?The?one?and?only?CChatApp?object
CChatApp?theApp;
/////////////////////////////////////////////////////////////////////////////
//?CChatApp?initialization
BOOL?CChatApp::InitInstance()
{
if(!AfxSocketInit())
{
AfxMessageBox(“加載套接字庫失敗!“);
return?FALSE;
}
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
CChatDlg?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;
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件??????35772??2010-08-06?14:53??Chat\Chat.aps
?????文件???????1196??2010-08-06?14:52??Chat\Chat.clw
?????文件???????2122??2010-08-05?16:48??Chat\Chat.cpp
?????文件???????4123??2010-08-05?16:05??Chat\Chat.dsp
?????文件????????516??2010-08-05?18:21??Chat\Chat.dsw
?????文件???????1302??2010-08-05?16:05??Chat\Chat.h
?????文件??????66560??2010-08-06?14:53??Chat\Chat.ncb
?????文件??????54784??2010-08-06?14:53??Chat\Chat.opt
?????文件???????1163??2010-08-06?14:53??Chat\Chat.plg
?????文件???????5518??2010-08-06?14:53??Chat\Chat.rc
?????文件???????6073??2010-08-06?11:50??Chat\ChatDlg.cpp
?????文件???????1599??2010-08-06?11:43??Chat\ChatDlg.h
?????文件?????106550??2010-08-06?14:53??Chat\Debug\Chat.exe
?????文件?????209016??2010-08-06?14:53??Chat\Debug\Chat.ilk
?????文件??????13523??2010-08-06?11:44??Chat\Debug\Chat.obj
?????文件????5583348??2010-08-05?16:48??Chat\Debug\Chat.pch
?????文件?????386048??2010-08-06?14:53??Chat\Debug\Chat.pdb
?????文件???????2636??2010-08-06?14:53??Chat\Debug\Chat.res
?????文件??????30059??2010-08-06?14:53??Chat\Debug\ChatDlg.obj
?????文件?????106757??2010-08-05?16:48??Chat\Debug\StdAfx.obj
?????文件?????214016??2010-08-06?14:53??Chat\Debug\vc60.idb
?????文件?????364544??2010-08-06?14:53??Chat\Debug\vc60.pdb
?????文件???????3543??2010-08-05?16:05??Chat\ReadMe.txt
?????文件???????1078??2010-08-06?14:53??Chat\res\Chat.ico
?????文件????????396??2010-08-05?16:05??Chat\res\Chat.rc2
?????文件????????865??2010-08-06?14:53??Chat\resource.h
?????文件????????206??2010-08-05?16:05??Chat\StdAfx.cpp
?????文件???????1073??2010-08-05?16:48??Chat\StdAfx.h
?????目錄??????????0??2010-08-11?20:55??Chat\Debug
?????目錄??????????0??2010-08-11?20:55??Chat\res
............此處省略4個文件信息
- 上一篇:mfc打開并顯示BMP圖片
- 下一篇:vc++課程設計——聊天室
評論
共有 條評論