资源简介
我知道VC6网络编程有很多有趣的方法,但是我觉得适合新手学习的是Socket编程。本例子经我长期使用和调试,代码简单,注释明了,希望大家喜欢。

代码片段和文件信息
// Client.cpp : Defines the class behaviors for the application.
//
#include “stdafx.h“
#include “Client.h“
#include “MainFrm.h“
#include “ClientDoc.h“
#include “ClientView.h“
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CClientApp
BEGIN_MESSAGE_MAP(CClientApp CWinApp)
//{{AFX_MSG_MAP(CClientApp)
ON_COMMAND(ID_APP_ABOUT OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CClientApp construction
CClientApp::CClientApp()
{
// TODO: add construction code here
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CClientApp object
CClientApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CClientApp initialization
BOOL CClientApp::InitInstance()
{
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
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
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T(“Local AppWizard-Generated Applications“));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application‘s document templates. Document templates
// serve as the connection between documents frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINframe
RUNTIME_CLASS(CClientDoc)
RUNTIME_CLASS(CMainframe) // main SDI frame window
RUNTIME_CLASS(CClientView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands DDE file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2013-10-01 14:14 Socket编程.服务器支持多客户端\
目录 0 2013-10-01 16:07 Socket编程.服务器支持多客户端\Client\
文件 28156 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Client.aps
文件 2487 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Client.clw
文件 4208 2013-10-01 14:15 Socket编程.服务器支持多客户端\Client\Client.cpp
文件 4681 2013-10-01 15:45 Socket编程.服务器支持多客户端\Client\Client.dsp
文件 537 2013-10-01 14:15 Socket编程.服务器支持多客户端\Client\Client.dsw
文件 1356 2013-10-01 14:15 Socket编程.服务器支持多客户端\Client\Client.h
文件 74752 2013-10-01 16:07 Socket编程.服务器支持多客户端\Client\Client.ncb
文件 50688 2013-10-01 16:07 Socket编程.服务器支持多客户端\Client\Client.opt
文件 4069 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Client.plg
文件 11053 2013-10-01 15:44 Socket编程.服务器支持多客户端\Client\Client.rc
文件 1742 2013-10-01 14:15 Socket编程.服务器支持多客户端\Client\ClientDoc.cpp
文件 1475 2013-10-01 14:15 Socket编程.服务器支持多客户端\Client\ClientDoc.h
文件 4562 2013-10-01 15:26 Socket编程.服务器支持多客户端\Client\ClientView.cpp
文件 2029 2013-10-01 15:03 Socket编程.服务器支持多客户端\Client\ClientView.h
目录 0 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\
文件 118857 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\Client.exe
文件 341792 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\Client.ilk
文件 23194 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\Client.obj
文件 5573712 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\Client.pch
文件 345088 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\Client.pdb
文件 6848 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\Client.res
文件 14874 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\ClientDoc.obj
文件 33398 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\ClientView.obj
文件 15861 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\MainFrm.obj
文件 8666 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\MySocket.obj
文件 106699 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\StdAfx.obj
文件 197632 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\vc60.idb
文件 372736 2013-10-01 16:05 Socket编程.服务器支持多客户端\Client\Debug\vc60.pdb
文件 1569 2013-10-01 15:34 Socket编程.服务器支持多客户端\Client\MainFrm.cpp
............此处省略80个文件信息
- 上一篇:MFC图片预览与缩放
- 下一篇:VC++单文档视图打开bmp图片
相关资源
- C++多线程网络编程Socket
- 移木块游戏,可以自编自玩,vc6.0编写
- MFC数字钟(基于VC6.0)
- 安科瑞智能电能表MODBUS通讯程序 VC6
- VC6LineNumberAddin.dll
- 用VC6.0实现多边形扫描线填充算法
- VC助手 VC6.0助手
- 简易web服务器的设计与实现
- 高性能服务器代码(50_06th_server_thre
- socket客户端.c
- socket服务端.c
- TCP/IP客户端和服务器端源代码,好用
- socket tcp应用
- socket通讯c++源码(客户端+服务端)
- MFC的异步网络通讯应用程序
- c++实现的文件上传服务器
- ffmpeg推流视频文件到rtmp服务器
- 各种关于CAsyncSocketCSocket内幕及其用法
- VC6.0 完整的图像处理程序 运用了大量
- MFC多人聊天室
- 使用socket套接字发送udp数据包
- CAsyncSocket异步实现服务器与客户端
- VC6.0经典串口通信源程序C++
- VC6.0MFC界面美化
- 即时通讯开发源码终极版C#.NETC++都有
- c++编写的smtp和pop3服务器实现
- VS打开VC6.0所需libcd.lib
- MFC画圆自定义|位置|半径|边界和内部
- 基于socket文件传输的实现源码[C++]
- 用vc++6.0实现的银行账户管理系统
评论
共有 条评论