⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 instantmessengerview.cpp

📁 c++系统开发实例精粹内附的80例源代码 环境:windows2000,c++6.0
💻 CPP
字号:
//////////////////////////////////////////////////////////////////////
// FileFury
// Copyright (c) 2000 Tenebril Incorporated
// All rights reserved.
//
// This source code is governed by the Tenebril open source
// license (http://www.tenebril.com/developers/opensource/license.html)
//
// For more information on this and other open source applications,
// visit the Tenebril OpenSource page:
//       http://www.tenebril.com/developers/opensource
//
//////////////////////////////////////////////////////////////////////

// InstantMessengerView.cpp : implementation file
//

#include "stdafx.h"
#include "Oscar.h"
#include "InstantMessengerView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CInstantMessengerView

IMPLEMENT_DYNCREATE(CInstantMessengerView, CView)

CInstantMessengerView::CInstantMessengerView()
{
}

CInstantMessengerView::~CInstantMessengerView()
{
}


BEGIN_MESSAGE_MAP(CInstantMessengerView, CView)
	//{{AFX_MSG_MAP(CInstantMessengerView)
	ON_WM_CREATE()
	ON_WM_ERASEBKGND()
	ON_WM_SIZE()
	ON_WM_LBUTTONDBLCLK()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CInstantMessengerView drawing

void CInstantMessengerView::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CInstantMessengerView diagnostics

#ifdef _DEBUG
void CInstantMessengerView::AssertValid() const
{
	CView::AssertValid();
}

void CInstantMessengerView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CInstantMessengerView message handlers

int CInstantMessengerView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	// create CListCtrl
	VERIFY (m_cHistoryCtrl.Create (WS_CHILD | WS_VISIBLE, 
		CRect (0, 0, 0, 0), this, IDI_LIST));

	return 0;
}

BOOL CInstantMessengerView::OnEraseBkgnd(CDC* pDC) 
{
	// TODO: Add your message handler code here and/or call default
	
	return FALSE;
}

void CInstantMessengerView::OnSize(UINT nType, int cx, int cy) 
{
	CView::OnSize(nType, cx, cy);
	// resize list to fill the whole view
	m_cHistoryCtrl.MoveWindow (0, 0, cx, cy);	
}

void CInstantMessengerView::OnLButtonDblClk(UINT nFlags, CPoint point) 
{
	CView::OnLButtonDblClk(nFlags, point);

	// Find the target message.
	CHistoryStatement *pStatement = m_cHistoryCtrl.HitTest(point);

	if(pStatement)
	{
		// We hit a statement.

		// Get the app.
		COscarApp *pApp = (COscarApp *)AfxGetApp();
		ASSERT(pApp);

		// Only reply to people other than me.
		if(pStatement->m_cszIP.CompareNoCase(_T("127.0.0.1")) != 0)
		{
			// Show the Send Instant Message dialog, with the appropriate
			// destination.
			pApp->SendInstantMessage(pStatement->m_cszSpeaker, pStatement->m_cszIP);
		}
	}

	return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -