资源简介
在mfc下,使用网络套接字,实现了多线程的聊天程序
代码片段和文件信息
// 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
}
CChatApp::~CChatApp()
{
// TODO: add construction code here
// Place all significant initialization in InitInstance
WSACleanup();
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CChatApp object
CChatApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CChatApp initialization
BOOL CChatApp::InitInstance()
{
WORD wVersionRequested;
WSADATA wsaData;
int err;
wVersionRequested = MAKEWORD( 2 2 );
err = WSAStartup( wVersionRequested &wsaData );
if ( err != 0 ) {
return FALSE;
}
if ( LOBYTE( wsaData.wVersion ) != 2 ||
HIBYTE( wsaData.wVersion ) != 2 ) {
WSACleanup( );
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;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 35716 2005-08-29 20:33 Chat\Chat.aps
文件 1240 2005-08-29 20:48 Chat\Chat.clw
文件 2513 2005-08-29 04:02 Chat\Chat.cpp
文件 4163 2005-08-29 20:51 Chat\Chat.dsp
文件 533 2005-08-28 15:39 Chat\Chat.dsw
文件 1317 2005-08-29 04:02 Chat\Chat.h
文件 50176 2005-11-28 05:11 Chat\Chat.ncb
文件 48640 2005-11-28 05:11 Chat\Chat.opt
文件 1131 2005-08-30 00:58 Chat\Chat.plg
文件 5575 2005-08-29 20:33 Chat\Chat.rc
文件 6627 2005-10-10 01:57 Chat\ChatDlg.cpp
文件 1479 2005-08-29 18:10 Chat\ChatDlg.h
文件 3543 2005-08-28 15:39 Chat\ReadMe.txt
文件 1078 2005-08-28 15:39 Chat\res\Chat.ico
文件 396 2005-08-28 15:39 Chat\res\Chat.rc2
目录 0 2008-06-28 10:26 Chat\res
文件 866 2005-08-29 20:33 Chat\Resource.h
文件 206 2005-08-28 15:39 Chat\StdAfx.cpp
文件 1075 2005-08-29 03:57 Chat\StdAfx.h
目录 0 2008-06-28 10:26 Chat
----------- --------- ---------- ----- ----
166274 20
- 上一篇:IIR滤波器设计实验报告
- 下一篇:校园导航系统C语言版
评论
共有 条评论