点对点交谈的客户端程序Word格式文档下载.docx

上传人:b****6 文档编号:16811857 上传时间:2022-11-26 格式:DOCX 页数:19 大小:19.45KB
下载 相关 举报
点对点交谈的客户端程序Word格式文档下载.docx_第1页
第1页 / 共19页
点对点交谈的客户端程序Word格式文档下载.docx_第2页
第2页 / 共19页
点对点交谈的客户端程序Word格式文档下载.docx_第3页
第3页 / 共19页
点对点交谈的客户端程序Word格式文档下载.docx_第4页
第4页 / 共19页
点对点交谈的客户端程序Word格式文档下载.docx_第5页
第5页 / 共19页
点击查看更多>>
下载资源
资源描述

点对点交谈的客户端程序Word格式文档下载.docx

《点对点交谈的客户端程序Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《点对点交谈的客户端程序Word格式文档下载.docx(19页珍藏版)》请在冰豆网上搜索。

点对点交谈的客户端程序Word格式文档下载.docx

{

public:

CTalkcApp();

//Overrides

//ClassWizardgeneratedvirtualfunctionoverrides

//{{AFX_VIRTUAL(CTalkcApp)

public:

virtualBOOLInitInstance();

//}}AFX_VIRTUAL

//Implementation

//{{AFX_MSG(CTalkcApp)

//NOTE-theClassWizardwilladdandremovememberfunctionshere.

//DONOTEDITwhatyouseeintheseblocksofgeneratedcode!

//}}AFX_MSG

DECLARE_MESSAGE_MAP()

};

//{{AFX_INSERT_LOCATION}}

//MicrosoftVisualC++willinsertadditionaldeclarationsimmediatelybeforethepreviousline.

#endif//!

//talkc.cpp:

Definestheclassbehaviorsfortheapplication.

stdafx.h"

talkc.h"

talkcDlg.h"

#ifdef_DEBUG

#definenewDEBUG_NEW

#undefTHIS_FILE

staticcharTHIS_FILE[]=__FILE__;

//CTalkcApp

BEGIN_MESSAGE_MAP(CTalkcApp,CWinApp)

//{{AFX_MSG_MAP(CTalkcApp)

//NOTE-theClassWizardwilladdandremovemappingmacroshere.

//DONOTEDITwhatyouseeintheseblocksofgeneratedcode!

ON_COMMAND(ID_HELP,CWinApp:

:

OnHelp)

END_MESSAGE_MAP()

//CTalkcAppconstruction

CTalkcApp:

CTalkcApp()

//TODO:

addconstructioncodehere,

//PlaceallsignificantinitializationinInitInstance

}

//TheoneandonlyCTalkcAppobject

CTalkcApptheApp;

//CTalkcAppinitialization

BOOLCTalkcApp:

InitInstance()

if(!

AfxSocketInit())

{

AfxMessageBox(IDP_SOCKETS_INIT_FAILED);

returnFALSE;

}

AfxEnableControlContainer();

//Standardinitialization

//Ifyouarenotusingthesefeaturesandwishtoreducethesize

//ofyourfinalexecutable,youshouldremovefromthefollowing

//thespecificinitializationroutinesyoudonotneed.

#ifdef_AFXDLL

Enable3dControls();

//CallthiswhenusingMFCinasharedDLL

#else

Enable3dControlsStatic();

//CallthiswhenlinkingtoMFCstatically

CTalkcDlgdlg;

m_pMainWnd=&

dlg;

intnResponse=dlg.DoModal();

if(nResponse==IDOK)

//TODO:

Placecodeheretohandlewhenthedialogis

//dismissedwithOK

elseif(nResponse==IDCANCEL)

//dismissedwithCancel

//Sincethedialoghasbeenclosed,returnFALSEsothatweexitthe

//application,ratherthanstarttheapplication'

smessagepump.

returnFALSE;

//MySocket.h:

headerfile

defined(AFX_MYSOCKET_H__9741667D_315B_4915_BCDE_9F2125BA065C__INCLUDED_)

#defineAFX_MYSOCKET_H__9741667D_315B_4915_BCDE_9F2125BA065C__INCLUDED_

classCTalkcDlg;

//CMySocketcommandtarget

classCMySocket:

publicCAsyncSocket

//Attributes

//Operations

CMySocket();

virtual~CMySocket();

voidSetParent(CTalkcDlg*pDlg);

//{{AFX_VIRTUAL(CMySocket)

virtualvoidOnConnect(intnErrorCode);

virtualvoidOnReceive(intnErrorCode);

virtualvoidOnClose(intnErrorCode);

//Generatedmessagemapfunctions

//{{AFX_MSG(CMySocket)

private:

CTalkcDlg*m_pDlg;

//MySocket.cpp:

implementationfile

MySocket.h"

TalkcDlg.h"

//CMySocket

CMySocket:

CMySocket()

//putthememberpointertoNULL

m_pDlg=NULL;

~CMySocket()

//Donoteditthefollowinglines,whichareneededbyClassWizard.

#if0

BEGIN_MESSAGE_MAP(CMySocket,CAsyncSocket)

//{{AFX_MSG_MAP(CMySocket)

//}}AFX_MSG_MAP

#endif//0

//CMySocketmemberfunctions

voidCMySocket:

OnConnect(intnErrorCode)

if(nErrorCode==0)

//callthedialog'

sOnConnectfunction

m_pDlg->

OnConnect();

OnReceive(intnErrorCode)

sOnReceivefunction

OnReceive();

OnClose(intnErrorCode)

sOnClosefunction

OnClose();

SetParent(CTalkcDlg*pDlg)

//setthememberpointer

m_pDlg=pDlg;

//talkcDlg.h:

defined(AFX_TALKCDLG_H__AC4F7955_1012_4B99_946D_E63FFC0AD185__INCLUDED_)

#defineAFX_TALKCDLG_H__AC4F7955_1012_4B99_946D_E63FFC0AD185__INCLUDED_

//CTalkcDlgdialog

classCTalkcDlg:

publicCDialog

//Construction

voidOnClose();

voidOnConnect();

CMySocketm_sConnectSocket;

voidOnReceive();

CTalkcDlg(CWnd*pParent=NULL);

//standardconstructor

//DialogData

//{{AFX_DATA(CTalkcDlg)

enum{IDD=IDD_TALKC_DIALOG};

CListBoxm_listSent;

CListBoxm_listReceived;

CButtonm_btnConnect;

CStringm_strMsg;

CStringm_strServName;

intm_nServPort;

//}}AFX_DATA

//{{AFX_VIRTUAL(CTalkcDlg)

protected:

virtualvoidDoDataExchange(CDataExchange*pDX);

//DDX/DDVsupport

protected:

HICONm_hIcon;

//{{AFX_MSG(CTalkcDlg)

virtualBOOLOnInitDialog();

afx_msgvoidOnSysCommand(UINTnID,LPARAMlParam);

afx_msgvoidOnPaint();

afx_msgHCURSOROnQueryDragIcon();

afx_msgvoidOnButtonConnect();

afx_msgvoidOnSendMsg();

afx_msgvoidOnButtonClose();

//talkcDlg.cpp:

//CAboutDlgdialogusedforAppAbout

classCAboutDlg:

CAboutDlg();

//{{AFX_DATA(CAboutDlg)

enum{IDD=IDD_ABOUTBOX};

//{{AFX_VIRTUAL(CAboutDlg)

//{{AFX_MSG(CAboutDlg)

CAboutDlg:

CAboutDlg():

CDialog(CAboutDlg:

IDD)

//{{AFX_DATA_INIT(CAboutDlg)

//}}AFX_DATA_INIT

voidCAboutDlg:

DoDataExchange(CDataExchange*pDX)

CDialog:

DoDataExchange(pDX);

//{{AFX_DATA_MAP(CAboutDlg)

//}}AFX_DATA_MAP

BEGIN_MESSAGE_MAP(CAboutDlg,CDialog)

//{{AFX_MSG_MAP(CAboutDlg)

//Nomessagehandlers

CTalkcDlg:

CTalkcDlg(CWnd*pParent/*=NULL*/)

:

CDialog(CTalkcDlg:

IDD,pParent)

//{{AFX_DATA_INIT(CTalkcDlg)

m_strMsg=_T("

"

);

m_strServName=_T("

m_nServPort=0;

//NotethatLoadIcondoesnotrequireasubsequentDestroyIconinWin32

m_hIcon=AfxGetApp()->

LoadIcon(IDR_MAINFRAME);

voidCTalkcDlg:

//{{AFX_DATA_MAP(CTalkcDlg)

DDX_Control(pDX,IDC_LIST_SENT,m_listSent);

DDX_Control(pDX,IDC_LIST_RECEIVED,m_listReceived);

DDX_Control(pDX,IDC_BUTTON_CONNECT,m_btnConnect);

DDX_Text(pDX,IDC_EDIT_MSG,m_strMsg);

DDX_Text(pDX,IDC_EDIT_SERVNAME,m_strServName);

DDX_Text(pDX,IDC_EDIT_SERVPORT,m_nServPort);

BEGIN_MESSAGE_MAP(CTalkcDlg,CDialog)

//{{AFX_MSG_MAP(CTalkcDlg)

ON_WM_SYSCOMMAND()

ON_WM_PAINT()

ON_WM_QUERYDRAGICON()

ON_BN_CLICKED(IDC_BUTTON_CONNECT,OnButtonConnect)

ON_BN_CLICKED(IDOK,OnSendMsg)

ON_BN_CLICKED(IDC_BUTTON_CLOSE,OnButtonClose)

//CTalkcDlgmessa

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 语文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1