QuickFTP.cpp
资源名称:FTP总集.rar [点击查看]
上传用户:tjfeida
上传日期:2013-03-10
资源大小:1917k
文件大小:8k
源码类别:
Ftp客户端
开发平台:
Visual C++
- // QuickFTP.cpp : Defines the class behaviors for the application.
- //
- /*********************************************
- **该文件是属于WolfFTP工程中的。如果有什么问题
- **请联系
- ** tablejiang@21cn.com
- **或者访问
- ** http://wolfftp.51.net
- **以得到最新的支持。
- *********************************************/
- #include "stdafx.h"
- #include "QuickFTP.h"
- #include "MainFrm.h"
- #include "QuickFTPDoc.h"
- #include "QuickFTPView.h"
- #include "TransmitFileDlg.h"
- #include "Verinfo.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CQuickFTPApp
- BEGIN_MESSAGE_MAP(CQuickFTPApp, CWinApp)
- //{{AFX_MSG_MAP(CQuickFTPApp)
- 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)
- // Standard print setup command
- ON_COMMAND(ID_FILE_PRINT_SETUP, CWinApp::OnFilePrintSetup)
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CQuickFTPApp construction
- CQuickFTPApp::CQuickFTPApp()
- {
- // TODO: add construction code here,
- // Place all significant initialization in InitInstance
- }
- /////////////////////////////////////////////////////////////////////////////
- // The one and only CQuickFTPApp object
- CQuickFTPApp theApp;
- /////////////////////////////////////////////////////////////////////////////
- // CQuickFTPApp initialization
- BOOL CQuickFTPApp::InitInstance()
- {
- //run welcome windows .
- //m_WelDlg.Create( IDD_DIALOG_WELCOME ) ;
- //m_WelDlg.ShowWindow( SW_SHOW ) ;
- 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(CQuickFTPDoc),
- RUNTIME_CLASS(CMainFrame), // main SDI frame window
- RUNTIME_CLASS(CQuickFTPView));
- 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.
- //cancel by table: execute this code in CMainFrame::OnCreate() function .
- /*
- m_pMainWnd->ShowWindow(SW_SHOWMAXIMIZED);
- m_pMainWnd->UpdateWindow();
- m_FileTransmitDlg.Create( IDD_DIALOG_MULTI , NULL ) ;
- m_FileTransmitDlg.ShowWindow( SW_SHOW ) ;
- CMainFrame * pMainWnd = ( CMainFrame * )m_pMainWnd ;
- pMainWnd->m_pJobListDlg = &m_FileTransmitDlg ;
- */
- //load accelerators .
- ::LoadAccelerators( m_hInstance , MAKEINTRESOURCE( IDR_MAINFRAME ) ) ;
- //set window text .
- char szVer[MAX_PATH] ;
- LoadString( NULL , IDS_STRING61447_VERSION , szVer , MAX_PATH ) ;
- ::SetWindowText( m_pMainWnd->m_hWnd , szVer ) ;
- return TRUE;
- }
- CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
- {
- //{{AFX_DATA_INIT(CAboutDlg)
- m_DisplayStr = _T("") ;
- m_DisplayStr = DebugInfo ;
- //}}AFX_DATA_INIT
- //m_Brush = ::CreateSolidBrush( DLG_BK_HBRUSH );
- m_IsHand = 0 ;
- }
- void CAboutDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CAboutDlg)
- DDX_Text(pDX, IDC_EDIT_MESSAGE, m_DisplayStr);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
- //{{AFX_MSG_MAP(CAboutDlg)
- ON_WM_LBUTTONDOWN()
- ON_WM_MOUSEMOVE()
- ON_WM_PAINT()
- ON_WM_CTLCOLOR()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- // App command to run the dialog
- void CQuickFTPApp::OnAppAbout()
- {
- CAboutDlg aboutDlg;
- aboutDlg.DoModal();
- }
- /////////////////////////////////////////////////////////////////////////////
- // CQuickFTPApp message handlers
- void CAboutDlg::OnLButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- //if user click the rectangle , popup the mail dialog.
- if( PtInRect( &m_MailRect , point ) )
- ::ShellExecute( NULL , "open","MailTo:tablejiang@sina.com",NULL,NULL,SW_SHOWNORMAL);
- //is user click web recttangle.
- if( PtInRect( &m_WebRect , point ) )
- ::ShellExecute( NULL , "open" , "http://wolfftp.51.net" , NULL , NULL , SW_SHOWNORMAL ) ;
- CDialog::OnLButtonDown(nFlags, point);
- }
- void CAboutDlg::OnMouseMove(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- //if( m_IsHand == 1 )
- ::SetCursor( m_hArrow ) ;
- CClientDC dc(this ) ;
- dc.SetBkMode( TRANSPARENT ) ;
- dc.SetTextColor( RGB( 0 , 0,0 ) ) ;
- dc.TextOut( m_MailRect.left , m_MailRect.top , "联系作者" ) ;
- dc.TextOut( m_WebRect.left , m_WebRect.top , "下载最新版本" ) ;
- m_IsHand = 0 ;
- //is mouse move on mail rectangle ?
- if( PtInRect( &m_MailRect , point ) )
- {
- //if( m_IsHand == 0 )
- ::SetCursor( m_hHand ) ;
- CClientDC dc(this ) ;
- dc.SetBkMode( TRANSPARENT ) ;
- dc.SetTextColor( RGB( 0, 0 , 255 ) ) ;
- dc.TextOut( m_MailRect.left , m_MailRect.top , "联系作者" ) ;
- m_IsHand = 1 ;
- }
- if( PtInRect( &m_WebRect , point ) )
- {
- //if( m_IsHand == 0 )
- ::SetCursor( m_hHand ) ;
- CClientDC dc(this ) ;
- dc.SetBkMode( TRANSPARENT ) ;
- dc.SetTextColor( RGB( 0, 0 , 255 ) ) ;
- dc.TextOut( m_WebRect.left , m_WebRect.top , "下载最新版本" ) ;
- m_IsHand = 1 ;
- }
- CDialog::OnMouseMove(nFlags, point);
- }
- BOOL CAboutDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- m_hArrow = ::AfxGetApp()->LoadCursor( IDC_MYARROW ) ;
- m_hHand = ::AfxGetApp()->LoadCursor( IDC_MYHAND ) ;
- //set mail rectangle .
- GetClientRect( &m_MailRect ) ;
- m_MailRect.top = m_MailRect.bottom - 40 ;
- m_MailRect.left = 30 ;
- m_MailRect.right = 230 ;
- m_MailRect.bottom = m_MailRect.top + 20 ;
- m_WebRect.top = m_MailRect.bottom ;
- m_WebRect.left = 30 ;
- m_WebRect.right = 230 ;
- m_WebRect.bottom = m_WebRect.top + 20 ;
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CAboutDlg::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
- // TODO: Add your message handler code here
- dc.SetBkMode( TRANSPARENT ) ;
- dc.SetTextColor( RGB( 0 , 0,0 ) ) ;
- dc.TextOut( m_MailRect.left , m_MailRect.top , "联系作者" ) ;
- dc.TextOut( m_WebRect.left , m_WebRect.top , "下载最新版本" ) ;
- // Do not call CDialog::OnPaint() for painting messages
- }
- HBRUSH CAboutDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
- {
- HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
- // TODO: Change any attributes of the DC here
- /*
- if( nCtlColor != CTLCOLOR_EDIT && nCtlColor != CTLCOLOR_LISTBOX )
- {
- pDC->SetBkMode( TRANSPARENT );
- return m_Brush ;
- }
- */
- // TODO: Return a different brush if the default is not desired
- return hbr;
- }