資源簡(jiǎn)介
能實(shí)現(xiàn)局域網(wǎng)內(nèi)的點(diǎn)對(duì)點(diǎn)聊天,同時(shí)能實(shí)現(xiàn)局域網(wǎng)內(nèi)文件傳送。

代碼片段和文件信息
//?Chat.cpp?:?Defines?the?class?behaviors?for?the?application.
//
#include?“stdafx.h“
#include?“Chat.h“
#include?“ChatDlg.h“
#include?
#pragma?comment(lib?“Ws2_32.lib“)
#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()
{
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
????
//******加載同步套接字庫(kù)
????/*WORD?wVersionRequested1;
WSADATA?wsaData1;
int?err1;
????wVersionRequested1=MAKEWORD(11);
????err1=WSAStartup(wVersionRequested1&wsaData1);
if(err1!=0)
{
return?FALSE;
}
if(LOBYTE(wsaData1.wVersion)!=2||HIBYTE(wsaData1.wVersion)!=2)
{
WSACleanup();
return?FALSE;
}*/
//**********
//*******加載異步套接字庫(kù)
WORD?wVersionRequested;
WSADATA?wsaData;
int?err;
????wVersionRequested=MAKEWORD(22);
????err=WSAStartup(wVersionRequested&wsaData);
if(err!=0)
{
return?FALSE;
}
if(LOBYTE(wsaData.wVersion)!=2||HIBYTE(wsaData.wVersion)!=2)
{
WSACleanup();
return?FALSE;
}
????//******************
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;
}
CChatApp::~CChatApp()
{
WSACleanup();
}
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2011-07-19?19:27??Chat\
?????文件????????3582??2011-07-12?16:15??Chat\1.ICO
?????文件????????1270??2011-07-18?20:12??Chat\bitmap1.bmp
?????文件???????43972??2011-07-19?21:26??Chat\Chat.aps
?????文件????????1402??2011-07-20?15:10??Chat\Chat.clw
?????文件????????2850??2011-07-19?20:49??Chat\Chat.cpp
?????文件????????4369??2011-07-19?15:54??Chat\Chat.dsp
?????文件?????????514??2011-07-18?21:08??Chat\Chat.dsw
?????文件????????1325??2011-07-19?20:49??Chat\Chat.h
?????文件???????74752??2011-07-20?15:11??Chat\Chat.ncb
?????文件???????56832??2011-07-20?15:11??Chat\Chat.opt
?????文件?????????685??2011-07-20?14:58??Chat\Chat.plg
?????文件????????6361??2011-07-19?21:26??Chat\Chat.rc
?????文件???????16841??2011-07-20?14:58??Chat\ChatDlg.cpp
?????文件????????2461??2011-07-19?21:44??Chat\ChatDlg.h
?????文件????????1790??2011-07-12?21:49??Chat\color.ico
?????目錄???????????0??2011-07-19?19:27??Chat\Debug\
?????文件?????5555200??2011-07-20?14:58??Chat\Debug\Chat.bsc
?????文件??????127015??2011-07-20?14:58??Chat\Debug\Chat.exe
?????文件??????387884??2011-07-20?14:58??Chat\Debug\Chat.ilk
?????文件???????14065??2011-07-19?21:45??Chat\Debug\Chat.obj
?????文件?????7117276??2011-07-19?15:41??Chat\Debug\Chat.pch
?????文件??????451584??2011-07-20?14:58??Chat\Debug\Chat.pdb
?????文件???????10124??2011-07-19?21:27??Chat\Debug\Chat.res
?????文件???????????0??2011-07-19?21:45??Chat\Debug\Chat.sbr
?????文件???????56896??2011-07-20?14:58??Chat\Debug\ChatDlg.obj
?????文件???????????0??2011-07-20?14:58??Chat\Debug\ChatDlg.sbr
?????文件??????111613??2011-07-19?15:41??Chat\Debug\StdAfx.obj
?????文件?????1413974??2011-07-19?15:41??Chat\Debug\StdAfx.sbr
?????文件??????222208??2011-07-20?14:58??Chat\Debug\vc60.idb
?????文件??????380928??2011-07-20?14:58??Chat\Debug\vc60.pdb
............此處省略8個(gè)文件信息
- 上一篇:完整的C++文字游戲
- 下一篇:C語(yǔ)言編寫的跨平臺(tái)線程庫(kù)
評(píng)論
共有 條評(píng)論