資源簡介
基于MFC的飛秋源碼,局域網的即時通信和文件的傳輸
代碼片段和文件信息
//?ChatView.cpp?:?implementation?file
//
#include?“stdafx.h“
#include?“FeiQ.h“
#include?“FileClient.h“
#include?“ChatView.h“
#ifdef?_DEBUG
#define?new?DEBUG_NEW
#undef?THIS_FILE
static?char?THIS_FILE[]?=?__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//?CChatView
IMPLEMENT_DYNCREATE(CChatView?CFormView)
CChatView::CChatView()
:?CFormView(CChatView::IDD)
{
//{{AFX_DATA_INIT(CChatView)
//?NOTE:?the?ClassWizard?will?add?member?initialization?here
//}}AFX_DATA_INIT
????m_pUserClient?=?NULL;
}
CChatView::~CChatView()
{
}
void?CChatView::DoDataExchange(CDataExchange*?pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CChatView)
DDX_Control(pDX?IDC_CHATUSER?m_wndChatUser);
DDX_Control(pDX?IDC_CHATLIST?m_wndChatList);
DDX_Control(pDX?IDC_CHATDATA?m_wndChatData);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CChatView?CFormView)
//{{AFX_MSG_MAP(CChatView)
ON_BN_CLICKED(IDC_SEND?OnSend)
ON_WM_CREATE()
ON_BN_CLICKED(IDC_SENDFILE?OnSendfile)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
//?CChatView?diagnostics
#ifdef?_DEBUG
void?CChatView::AssertValid()?const
{
CFormView::AssertValid();
}
void?CChatView::Dump(CDumpContext&?dc)?const
{
CFormView::Dump(dc);
}
#endif?//_DEBUG
/////////////////////////////////////////////////////////////////////////////
//?CChatView?message?handlers
int?CChatView::OnCreate(LPCREATESTRUCT?lpCreateStruct)?
{
if?(CFormView::OnCreate(lpCreateStruct)?==?-1)
return?-1;
return?0;
}
void?CChatView::OnInitialUpdate()?
{
CFormView::OnInitialUpdate();
????m_wndChatUser.SetCurSel(?0?);
}
void?CChatView::OnSend()?
{
????if(?NULL?==?m_pUserClient?)
????{
????????return;
????}
????CString?strChat;
????m_wndChatData.GetWindowText(?strChat?);
????int?nSel?=?m_wndChatUser.GetCurSel(?);
????if(?nSel?==?0?)
????{
????????m_pUserClient->SendChat(?““?strChat?);
????}
????else
????{
????????CString?strIP;
????????m_wndChatUser.GetLBText(?nSel?strIP?);
????????m_pUserClient->SendChat(?strIP?strChat?FALSE?);
????}
}
void?CChatView::AddUser(?CString?strIP?)
{
????if(?-1?!=?m_wndChatUser.FindString(?0?strIP?)?)
????{
????????return;
????}
????m_wndChatUser.AddString(?strIP?);
}
void?CChatView::DelUser(?CString?strIP?)
{???
????int?nItem?=?m_wndChatUser.FindString(?0?strIP?);
????if(?-1?!=?nItem?)
????{
????????return;
????}
????m_wndChatUser.DeleteString(?nItem?);
}
void?CChatView::AddChat(?CString?strChat?CString?strIP?)
{???//將聊天數據添加到List中
????CString?strData?=?strIP?+?“:?“?+?strChat;
????int?nItem?=?m_wndChatList.AddString(?strData?);
????m_wndChatList.SetCurSel(?nItem?);
}
#include?“FileThread.h“
void?CChatView::OnSendfile()?
{???//選擇當前要發送的IP地址
????int?nSel?=?m_wndChatUser.GetCurSel(?);
????if(?nSel?==?0?)
????{
????????AfxMessageBox(?“請選擇要發送的
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????3594??2011-01-27?15:41??FeiQ\ChatView.cpp
?????文件???????1894??2011-01-27?10:43??FeiQ\ChatView.h
?????文件??????56088??2014-09-26?11:08??FeiQ\Debug\ChatView.obj
?????文件???????8246??2014-09-26?11:08??FeiQ\Debug\cl.command.1.tlog
?????文件??????34178??2014-09-26?11:08??FeiQ\Debug\CL.read.1.tlog
?????文件???????2878??2014-09-26?11:08??FeiQ\Debug\CL.write.1.tlog
?????文件?????145408??2014-09-26?11:08??FeiQ\Debug\FeiQ.exe
?????文件????????667??2014-09-26?11:08??FeiQ\Debug\FeiQ.exe.em
?????文件????????732??2014-09-26?11:08??FeiQ\Debug\FeiQ.exe.em
?????文件????????381??2014-09-26?11:08??FeiQ\Debug\FeiQ.exe.intermediate.manifest
?????文件????1686840??2014-09-26?11:08??FeiQ\Debug\FeiQ.ilk
?????文件?????????40??2014-09-26?11:08??FeiQ\Debug\FeiQ.lastbuildstate
?????文件???????6107??2014-09-26?11:08??FeiQ\Debug\FeiQ.log
?????文件??????38766??2014-09-26?11:08??FeiQ\Debug\FeiQ.obj
?????文件???20578304??2014-09-26?11:08??FeiQ\Debug\FeiQ.pch
?????文件????3968000??2014-09-26?11:08??FeiQ\Debug\FeiQ.pdb
?????文件???????5724??2014-09-26?11:08??FeiQ\Debug\FeiQ.res
?????文件????????204??2014-09-26?11:08??FeiQ\Debug\FeiQ_manifest.rc
?????文件??????13292??2014-09-26?11:08??FeiQ\Debug\FileClient.obj
?????文件??????30981??2014-09-26?11:08??FeiQ\Debug\FileRecvDlg.obj
?????文件??????25591??2014-09-26?11:08??FeiQ\Debug\FileSendDlg.obj
?????文件??????11281??2014-09-26?11:08??FeiQ\Debug\FileServer.obj
?????文件??????25876??2014-09-26?11:08??FeiQ\Debug\FileThread.obj
?????文件??????????2??2014-09-26?11:08??FeiQ\Debug\li
?????文件??????????2??2014-09-26?11:08??FeiQ\Debug\li
?????文件???????2224??2014-09-26?11:08??FeiQ\Debug\li
?????文件???????5310??2014-09-26?11:08??FeiQ\Debug\li
?????文件???????1218??2014-09-26?11:08??FeiQ\Debug\li
?????文件??????36736??2014-09-26?11:08??FeiQ\Debug\MainFrm.obj
?????文件????????658??2014-09-26?11:08??FeiQ\Debug\mt.command.1.tlog
............此處省略61個文件信息
- 上一篇:基于模糊的自適應閾值分割
- 下一篇:C++ QT5教程 開發大全和教程 完整
評論
共有 條評論