MyListBoxView.cpp
资源名称:FTP总集.rar [点击查看]
上传用户:tjfeida
上传日期:2013-03-10
资源大小:1917k
文件大小:4k
源码类别:
Ftp客户端
开发平台:
Visual C++
- // MyListBoxView.cpp : implementation file
- //
- /*********************************************
- **该文件是属于WolfFTP工程中的。如果有什么问题
- **请联系
- ** tablejiang@21cn.com
- **或者访问
- ** http://wolfftp.51.net
- **以得到最新的支持。
- *********************************************/
- #include "stdafx.h"
- #include "MyListBoxView.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMyListBoxView
- IMPLEMENT_DYNCREATE(CMyInfoView, CView)
- CMyInfoView::CMyInfoView()
- {
- }
- CMyInfoView::~CMyInfoView()
- {
- }
- BEGIN_MESSAGE_MAP(CMyInfoView, CView)
- //{{AFX_MSG_MAP(CMyListBoxView)
- ON_WM_SIZE()
- ON_WM_LBUTTONDOWN()
- ON_WM_CREATE()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CMyListBoxView drawing
- void CMyInfoView::OnDraw(CDC* pDC)
- {
- CQuickFTPDoc* pDoc = GetDocument();
- // TODO: add draw code here
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMyListBoxView diagnostics
- #ifdef _DEBUG
- void CMyInfoView::AssertValid() const
- {
- CView::AssertValid();
- }
- void CMyInfoView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
- #endif //_DEBUG
- CQuickFTPDoc* CMyInfoView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CQuickFTPDoc)));
- return (CQuickFTPDoc*)m_pDocument;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMyListBoxView message handlers
- void CMyInfoView::OnInitialUpdate()
- {
- CView::OnInitialUpdate();
- // TODO: Add your specialized code here and/or call the base class
- RECT rect ;
- ::GetClientRect( this->m_hWnd , &rect ) ;
- m_Edit.Create( WS_CHILD | WS_VISIBLE |WS_VSCROLL | WS_TABSTOP |ES_MULTILINE |ES_LEFT
- | ES_READONLY | ES_AUTOVSCROLL, rect , this , 0x1113 ) ;
- CHARFORMAT cf;
- memset( &cf , 0 , sizeof( cf ) ) ;
- cf.cbSize = sizeof( cf ) ;
- cf.dwMask = CFM_COLOR | CFM_SIZE ;
- cf.crTextColor = RGB( 0 , 0 , 0 ) ;
- cf.yHeight = 18 ;
- m_Edit.SetDefaultCharFormat( cf ) ;
- long nLimit = m_Edit.GetLimitText( ) ;
- m_Edit.LimitText( 999999999 ) ;
- nLimit = m_Edit.GetLimitText( ) ;
- }
- void CMyInfoView::OnSize(UINT nType, int cx, int cy)
- {
- CView::OnSize(nType, cx, cy);
- // TODO: Add your message handler code here
- if( m_Edit.m_hWnd != NULL )
- {
- RECT rect ;
- ::GetClientRect( this->m_hWnd , &rect ) ;
- m_Edit.MoveWindow( &rect , TRUE ) ;
- }
- }
- BOOL CMyInfoView::InsertString(LPCTSTR string)
- {
- m_Edit.AddString( string ) ;
- return TRUE ;
- }
- void CMyInfoView::OnLButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- CView::OnLButtonDown(nFlags, point);
- }
- LRESULT CMyInfoView::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
- {
- // TODO: Add your specialized code here and/or call the base class
- char *szReplyString ;
- switch( message )
- {
- case FTP_SERVER_REPLY_MSG:
- //display server reply string .
- m_Edit.SetTextColor( TEXT_COLOR_REPLY ) ;
- szReplyString = (char*)lParam ;
- InsertString( szReplyString ) ;
- delete szReplyString ;
- szReplyString = NULL ;
- break ;
- case FTP_SEND_COMMAND_MSG:
- //display send command .
- m_Edit.SetTextColor( TEXT_COLOR_COMMAND ) ;
- szReplyString = (char*)lParam ;
- InsertString( szReplyString ) ;
- delete szReplyString ;
- szReplyString = NULL ;
- break ;
- case FTP_STATUS_MSG :
- m_Edit.SetTextColor( TEXT_COLOR_STATUS ) ;
- szReplyString = (char*)lParam ;
- InsertString( szReplyString ) ;
- delete szReplyString ;
- break ;
- default :
- break ;
- }
- return CView::DefWindowProc(message, wParam, lParam);
- }