MainFrm.cpp
资源名称:FTP总集.rar [点击查看]
上传用户:tjfeida
上传日期:2013-03-10
资源大小:1917k
文件大小:17k
源码类别:
Ftp客户端
开发平台:
Visual C++
- // MainFrm.cpp : implementation of the CMainFrame class
- //
- /*********************************************
- **该文件是属于WolfFTP工程中的。如果有什么问题
- **请联系
- ** tablejiang@21cn.com
- **或者访问
- ** http://wolfftp.51.net
- **以得到最新的支持。
- *********************************************/
- #include "stdafx.h"
- #include "QuickFTP.h"
- #include "MainFrm.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame
- IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
- BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
- //{{AFX_MSG_MAP(CMainFrame)
- ON_WM_CREATE()
- ON_WM_SIZE()
- ON_COMMAND(IDR_FTP_CONNECT, OnFtpConnect)
- ON_COMMAND(IDR_FTP_SITEMANAGE, OnFtpSitemanage)
- ON_COMMAND(IDR_FTP_DISCONNECT, OnFtpDisconnect)
- ON_COMMAND(IDR_FTP_RECONNECT, OnFtpReconnect)
- ON_COMMAND(IDR_FTP_SETTING, OnFtpSetting)
- ON_WM_CHAR()
- ON_COMMAND(IDR_WINDOW_TRANSMITDLG, OnWindowTransmitdlg)
- ON_WM_CLOSE()
- ON_COMMAND(IDR_REMOTE_ABORD, OnRemoteAbord)
- ON_COMMAND(IDR_REMOTE_DELETE, OnRemoteDelete)
- ON_COMMAND(IDR_REMOTE_DOWNLOAD, OnRemoteDownload)
- ON_COMMAND(IDR_REMOTE_REFRESH, OnRemoteRefresh)
- ON_COMMAND(IDR_REMOTE_UPLOAD, OnRemoteUpload)
- ON_COMMAND(IDR_LOCAL_DELETE, OnLocalDelete)
- ON_COMMAND(IDR_LOCAL_DOWNLOAD, OnLocalDownload)
- ON_COMMAND(IDR_LOCAL_REFRESH, OnLocalRefresh)
- ON_COMMAND(IDR_LOCAL_UPLOAD, OnLocalUpload)
- ON_COMMAND(IDR_QUEUE_RUN, OnQueueRun)
- ON_COMMAND(IDR_QUEUE_STOP, OnQueueStop)
- ON_WM_RBUTTONDOWN()
- ON_COMMAND(IDR_REMOTE_EDIT, OnRemoteEdit)
- ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
- ON_COMMAND(IDR_REMOTE_MKDIR, OnRemoteMkdir)
- ON_UPDATE_COMMAND_UI(IDR_WINDOW_TRANSMITDLG, OnUpdateWindowTransmitdlg)
- ON_COMMAND(IDR_BACK_RUN, OnBackRun)
- ON_COMMAND(IDR_BACK_STOP, OnBackStop)
- ON_COMMAND(IDR_BACK_SELALL, OnBackSelall)
- ON_COMMAND(IDR_BACK_STOPALL, OnBackStopall)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- static UINT indicators[] =
- {
- ID_SEPARATOR, // status line indicator
- ID_INDICATOR_CAPS,
- ID_INDICATOR_NUM,
- ID_INDICATOR_SCRL,
- };
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame construction/destruction
- CMainFrame::CMainFrame()
- {
- // TODO: add member initialization code here
- m_bCreateSplitter = FALSE ;
- LoadDefaultSite( ) ;
- }
- CMainFrame::~CMainFrame()
- {
- SaveDefaultSite( ) ;
- }
- int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
- {
- if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
- return -1;
- if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
- | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
- !m_wndToolBar.LoadToolBar(IDR_MAINFRAME))
- {
- TRACE0("Failed to create toolbarn");
- return -1; // fail to create
- }
- if (!m_wndStatusBar.Create(this) ||
- !m_wndStatusBar.SetIndicators(indicators,
- sizeof(indicators)/sizeof(UINT)))
- {
- TRACE0("Failed to create status barn");
- return -1; // fail to create
- }
- //m_wndStatusBar.Create( WS_CHILD|WS_VISIBLE|CCS_BOTTOM|SBARS_SIZEGRIP,
- // CRect(0,0,0,0), this, 0x113 ) ;
- RECT rect ;
- GetWindowRect( &rect ) ;
- m_wndStatusBar.SetControlPos( rect.right - rect.left ) ;
- m_wndStatusBar.MoveWindow( 0 , 0 , 0 , 0 ) ;
- ShowWindow(SW_SHOWMAXIMIZED);
- UpdateWindow();
- // TODO: Delete these three lines if you don't want the toolbar to
- // be dockable
- m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
- EnableDocking(CBRS_ALIGN_ANY);
- DockControlBar(&m_wndToolBar);
- m_Ftp.m_hParentWnd = m_hWnd ;
- return 0;
- }
- BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
- CCreateContext* pContext)
- {
- RECT rect ;
- GetClientRect( &rect ) ;
- //
- m_JobListDlg.Create( IDD_DIALOG_MULTI , this ) ;
- m_JobListDlg.ShowWindow( SW_HIDE ) ;
- m_GeniusDlg.Create( IDD_DIALOG_GENIUS , &m_JobListDlg ) ;
- //m_GeniusDlg.ShowWindow( SW_HIDE ) ;
- m_GeniusDlg.SetTransmitWnd( m_JobListDlg.m_hWnd ) ;
- m_GeniusDlg.SetMainWnd( this ) ;
- //PostMessage( WM_SYSCOMMAND , SC_MAXIMIZE , 0 ) ;
- //SetWindowLong( m_hWnd , GWL_STYLE , WS_MAXIMIZE ) ;
- /*
- m_wndSplitter.CreateStatic(this,
- 3 , 1 ) ; // TODO: adjust the number of rows, columns
- m_wndSplitter.CreateView( 0 , 0 , RUNTIME_CLASS( CMyInfoView ) , CSize( rect.right , rect.bottom/3 ) , pContext ) ;
- m_wndSplitter.CreateView( 2 , 0 , RUNTIME_CLASS( CDownloadFileView ) , CSize( rect.right , rect.bottom/3 ) , pContext ) ;
- m_wndSplitter2.CreateStatic( &m_wndSplitter , 1 , 2 , WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
- m_wndSplitter.IdFromRowCol( 1 , 0) ) ;
- m_wndSplitter2.CreateView( 0 , 0 , RUNTIME_CLASS( CDirListView ) , CSize( rect.right/2 , rect.bottom/3 ) , pContext ) ;
- m_wndSplitter2.CreateView( 0 , 1 , RUNTIME_CLASS( CFtpDirView ) , CSize( rect.right/2 , rect.bottom/3 ) , pContext ) ;
- CFtpDirView* pFtpDirWnd = ( CFtpDirView *)m_wndSplitter2.GetPane( 0 , 1 ) ;
- CDirListView* pDirListWnd = ( CDirListView*)m_wndSplitter2.GetPane( 0 , 0 ) ;
- CMyInfoView* pFtpInfoWnd = ( CMyInfoView* )m_wndSplitter.GetPane( 0 , 0 ) ;
- CDownloadFileView* pDownFileWnd = ( CDownloadFileView*)m_wndSplitter.GetPane( 1 , 0 ) ;
- pFtpDirWnd->m_hDisplayWnd = pFtpInfoWnd->m_hWnd ;
- pFtpInfoWnd->m_hFtpDirListWnd = pFtpDirWnd->m_hWnd ;
- m_bCreateSplitter = TRUE ;
- m_ViewWndInfo.pFtpDirView = pFtpDirWnd ;
- m_ViewWndInfo.pDirListView = pDirListWnd ;
- m_ViewWndInfo.pDownFileView = pDownFileWnd ;
- m_ViewWndInfo.pInfoView = pFtpInfoWnd ;
- pFtpDirWnd->m_pFtp = &m_Ftp ;
- */
- m_wndSplitter.CreateStatic(this,
- 2 , 1 ) ; // TODO: adjust the number of rows, columns
- m_wndSplitter2.CreateStatic( &m_wndSplitter , 1 , 2 , WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
- m_wndSplitter.IdFromRowCol( 0 , 0) ) ;
- m_wndSplitter3.CreateStatic( &m_wndSplitter , 1 , 2 , WS_CHILD | WS_VISIBLE | WS_BORDER, // style, WS_BORDER is needed
- m_wndSplitter.IdFromRowCol( 1 , 0 ) ) ;
- m_wndSplitter3.CreateView( 0 , 0 , RUNTIME_CLASS( CDownloadFileView ) , CSize( rect.right/2 , rect.bottom/3 ) , pContext ) ;
- m_wndSplitter3.CreateView( 0 , 1 , RUNTIME_CLASS( CMyInfoView ) , CSize( rect.right/2 , rect.bottom/3 ) , pContext ) ;
- m_wndSplitter2.CreateView( 0 , 0 , RUNTIME_CLASS( CDirListView ) , CSize( rect.right/2 , rect.bottom*2/3 ) , pContext ) ;
- m_wndSplitter2.CreateView( 0 , 1 , RUNTIME_CLASS( CFtpDirView ) , CSize( rect.right/2 , rect.bottom*2/3 ) , pContext ) ;
- CFtpDirView* pFtpDirWnd = ( CFtpDirView *)m_wndSplitter2.GetPane( 0 , 1 ) ;
- CDirListView* pDirListWnd = ( CDirListView*)m_wndSplitter2.GetPane( 0 , 0 ) ;
- CMyInfoView* pFtpInfoWnd = ( CMyInfoView* )m_wndSplitter3.GetPane( 0 , 1 ) ;
- CDownloadFileView* pDownFileWnd = ( CDownloadFileView*)m_wndSplitter3.GetPane( 0 , 0 ) ;
- pFtpDirWnd->m_hDisplayWnd = pFtpInfoWnd->m_hWnd ;
- pFtpInfoWnd->m_hFtpDirListWnd = pFtpDirWnd->m_hWnd ;
- m_bCreateSplitter = TRUE ;
- m_ViewWndInfo.pFtpDirView = pFtpDirWnd ;
- m_ViewWndInfo.pDirListView = pDirListWnd ;
- m_ViewWndInfo.pDownFileView = pDownFileWnd ;
- m_ViewWndInfo.pInfoView = pFtpInfoWnd ;
- pFtpDirWnd->m_pFtp = &m_Ftp ;
- pDirListWnd->m_pFtp = &m_Ftp ;
- pDownFileWnd->m_pFtp = &m_Ftp ;
- m_Ftp.m_hWndInfo.hFtpDirListWnd = pFtpDirWnd->m_hWnd ;
- m_Ftp.m_hWndInfo.hInfoWnd = pFtpInfoWnd->m_hWnd ;
- m_Ftp.m_hWndInfo.hLocalDirListWnd = pDirListWnd->m_hWnd ;
- m_Ftp.m_hWndInfo.hWndJobWnd = pDownFileWnd->m_hWnd ;
- memcpy( &m_JobListDlg.m_Transmit.m_hWndInfo , &m_Ftp.m_hWndInfo , sizeof( HWNDINFO ) ) ;
- LISTINFO ListInfo ;
- ListInfo.hBkJobList = m_JobListDlg.m_ListCtrl.m_hWnd ;
- ListInfo.hCurJobList = pDownFileWnd->m_ListCtrl.m_hWnd ;
- ListInfo.hFtpList = pFtpDirWnd->m_ListCtrl.m_hWnd ;
- ListInfo.hLocalList = pDirListWnd->m_ListCtrl.m_hWnd ;
- ListInfo.hGenius = m_GeniusDlg.m_hWnd ;
- memcpy( &pFtpDirWnd->m_ListInfo , &ListInfo , sizeof( LISTINFO ) ) ;
- memcpy( &pDirListWnd->m_ListInfo , &ListInfo , sizeof( LISTINFO ) ) ;
- pFtpDirWnd->m_pBkTransmitDlg = &m_JobListDlg ;
- pDirListWnd->m_pBkTransmitDlg = &m_JobListDlg ;
- pDownFileWnd->SetFileQueue( &m_Ftp.m_FileQueue ) ;
- ConnectDefaultSite( ) ;
- return true ;
- }
- BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
- {
- if( !CFrameWnd::PreCreateWindow(cs) )
- return FALSE;
- // TODO: Modify the Window class or styles here by modifying
- // the CREATESTRUCT cs
- return TRUE;
- }
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame diagnostics
- #ifdef _DEBUG
- void CMainFrame::AssertValid() const
- {
- CFrameWnd::AssertValid();
- }
- void CMainFrame::Dump(CDumpContext& dc) const
- {
- CFrameWnd::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- // CMainFrame message handlers
- void CMainFrame::OnSize(UINT nType, int cx, int cy)
- {
- CFrameWnd::OnSize(nType, cx, cy);
- // TODO: Add your message handler code here
- RECT rect ;
- GetClientRect( &rect ) ;
- if( m_bCreateSplitter )
- {
- /*
- m_wndSplitter.SetRowInfo( 0 , rect.bottom/3 , 10 ) ;
- m_wndSplitter.SetRowInfo( 1 , rect.bottom/3 , 10 ) ;
- m_wndSplitter.SetRowInfo( 2 , rect.bottom/3 , 10 ) ;
- m_wndSplitter2.SetColumnInfo( 0 , rect.right / 2 , 10 ) ;
- m_wndSplitter2.SetColumnInfo( 1 , rect.right / 2 , 10 ) ;
- m_wndSplitter.RecalcLayout();
- m_wndSplitter2.RecalcLayout() ;
- */
- m_wndSplitter.SetRowInfo( 0 , rect.bottom*2/3 , 10 ) ;
- m_wndSplitter.SetRowInfo( 1 , rect.bottom/3 , 10 ) ;
- m_wndSplitter2.SetColumnInfo( 0 , rect.right / 2 , 10 ) ;
- m_wndSplitter2.SetColumnInfo( 1 , rect.right / 2 , 10 ) ;
- m_wndSplitter3.SetColumnInfo( 0 , rect.right / 2 , 10 ) ;
- m_wndSplitter3.SetColumnInfo( 1 , rect.right / 2 , 10 ) ;
- m_wndSplitter.RecalcLayout();
- m_wndSplitter2.RecalcLayout() ;
- }
- if( m_wndStatusBar.m_hWnd )
- {
- GetWindowRect( &rect ) ;
- m_wndStatusBar.SetControlPos( rect.right - rect.left ) ;
- //m_wndStatusBar.MoveWindow( 0 , 0 , 100 , 100 ) ;
- }
- }
- void CMainFrame::OnFtpConnect()
- {
- // TODO: Add your command handler code here
- CSetDlgInputSite dlg ;
- dlg.SetConnectEnable( true ) ;
- if( dlg.DoModal( ) == IDOK )
- {
- m_ViewWndInfo.pFtpDirView->DisconnectFtp( ) ;
- m_ViewWndInfo.pFtpDirView->ConnectFtp( &dlg.m_SiteInfo ) ;
- memcpy( &m_CurSiteInfo , &dlg.m_SiteInfo , sizeof( SITEINFO ) );
- }
- /*
- CSetDlgSelectSite SiteDlg;
- if( SiteDlg.DoModal() == IDOK )
- {
- m_ViewWndInfo.pFtpDirView->DisconnectFtp( ) ;
- m_ViewWndInfo.pFtpDirView->ConnectFtp( &SiteDlg.m_CurSelSite ) ;
- memcpy( &m_CurSiteInfo , &SiteDlg.m_CurSelSite , sizeof( SITEINFO ) );
- }
- */
- }
- void CMainFrame::OnFtpSitemanage()
- {
- // TODO: Add your command handler code here
- CSetDlgSelectSite SiteDlg;
- if( SiteDlg.DoModal() == IDOK )
- {
- m_ViewWndInfo.pFtpDirView->DisconnectFtp( ) ;
- m_ViewWndInfo.pFtpDirView->ConnectFtp( &SiteDlg.m_CurSelSite ) ;
- memcpy( &m_CurSiteInfo , &SiteDlg.m_CurSelSite , sizeof( SITEINFO ) );
- }
- }
- void CMainFrame::OnFtpDisconnect()
- {
- // TODO: Add your command handler code here
- m_ViewWndInfo.pFtpDirView->DisconnectFtp( ) ;
- }
- void CMainFrame::OnFtpReconnect()
- {
- // TODO: Add your command handler code here
- if( strlen( m_CurSiteInfo.host ) == 0 )
- return ;
- m_ViewWndInfo.pFtpDirView->DisconnectFtp( ) ;
- m_ViewWndInfo.pFtpDirView->ConnectFtp( &m_CurSiteInfo ) ;
- }
- void CMainFrame::OnFtpSetting()
- {
- // TODO: Add your command handler code here
- }
- void CMainFrame::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
- {
- // TODO: Add your message handler code here and/or call default
- CFrameWnd::OnChar(nChar, nRepCnt, nFlags);
- }
- void CMainFrame::OnWindowTransmitdlg()
- {
- // TODO: Add your command handler code here
- if( m_JobListDlg.IsWindowVisible( ) )
- m_JobListDlg.ShowWindow( SW_HIDE ) ;
- else
- m_JobListDlg.ShowWindow( SW_SHOW ) ;
- }
- void CMainFrame::OnClose()
- {
- // TODO: Add your message handler code here and/or call default
- m_Ftp.Logout( ) ;
- CFrameWnd::OnClose();
- }
- LRESULT CMainFrame::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
- {
- // TODO: Add your specialized code here and/or call the base class
- switch( message )
- {
- case FTP_TRANSMIT_DATA_MSG :
- {
- m_wndStatusBar.SetPos( wParam ) ;
- m_wndStatusBar.SetSpeed( lParam ) ;
- }
- break ;
- case SEND_TRANSMIT_FILENAME_MSG :
- {
- char* pName ;
- pName = (char*)wParam ;
- m_wndStatusBar.SetDisplayString( pName ) ;
- delete pName ;
- }
- break ;
- default :
- break ;
- }
- return CFrameWnd::DefWindowProc(message, wParam, lParam);
- }
- void CMainFrame::OnRemoteAbord()
- {
- // TODO: Add your command handler code here
- m_ViewWndInfo.pFtpDirView->AbordAction( ) ;
- }
- void CMainFrame::OnRemoteDelete()
- {
- // TODO: Add your command handler code here
- m_ViewWndInfo.pFtpDirView->DeleteSelectItem() ;
- }
- void CMainFrame::OnRemoteDownload()
- {
- // TODO: Add your command handler code here
- m_ViewWndInfo.pFtpDirView->DownLoadSelectItem( NULL ) ;
- }
- void CMainFrame::OnRemoteRefresh()
- {
- // TODO: Add your command handler code here
- m_ViewWndInfo.pFtpDirView->RefreshCurrentDirectory( ) ;
- }
- void CMainFrame::OnRemoteUpload()
- {
- // TODO: Add your command handler code here
- m_ViewWndInfo.pDirListView->UploadSelectItem( NULL ) ;
- }
- void CMainFrame::OnLocalDelete()
- {
- // TODO: Add your command handler code here
- m_ViewWndInfo.pDirListView->m_ListCtrl.DeleteSelectItem( ) ;
- }
- void CMainFrame::OnLocalDownload()
- {
- // TODO: Add your command handler code here
- m_ViewWndInfo.pFtpDirView->DownLoadSelectItem( NULL ) ;
- }
- void CMainFrame::OnLocalRefresh()
- {
- // TODO: Add your command handler code here
- m_ViewWndInfo.pDirListView->RefreshCurDir( ) ;
- }
- void CMainFrame::OnLocalUpload()
- {
- // TODO: Add your command handler code here
- m_ViewWndInfo.pDirListView->UploadSelectItem( NULL ) ;
- }
- void CMainFrame::OnQueueRun()
- {
- // TODO: Add your command handler code here
- m_ViewWndInfo.pDownFileView->SetSelectItemStatus( FILE_STATE_READY ) ;
- m_Ftp.RunJobList( ) ;
- }
- void CMainFrame::OnQueueStop()
- {
- // TODO: Add your command handler code here
- m_Ftp.SetStopSign( false ) ;
- m_ViewWndInfo.pDownFileView->SetSelectItemStatus( FILE_STATE_STOP ) ;
- }
- void CMainFrame::OnRButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- CFrameWnd::OnRButtonDown(nFlags, point);
- }
- void CMainFrame::OnRemoteEdit()
- {
- // TODO: Add your command handler code here
- m_ViewWndInfo.pFtpDirView->EditSelectItem( ) ;
- }
- void CMainFrame::OnAppAbout()
- {
- // TODO: Add your command handler code here
- CAboutDlg dlg ;
- dlg.DoModal( ) ;
- }
- void CMainFrame::OnRemoteMkdir()
- {
- // TODO: Add your command handler code here
- if( !m_Ftp.IsConnect( ) )
- return ;
- CInputFileNameDlg dlg ;
- dlg.m_strName = "新建目录" ;
- if( dlg.DoModal( ) == IDOK )
- {
- m_Ftp.CreateDirectory( dlg.m_strName ) ;
- }
- }
- void CMainFrame::OnUpdateWindowTransmitdlg(CCmdUI* pCmdUI)
- {
- // TODO: Add your command update UI handler code here
- if( m_JobListDlg.IsWindowVisible() )
- pCmdUI->SetCheck( ) ;
- else
- pCmdUI->SetCheck( 0 ) ;
- }
- void CMainFrame::OnBackRun()
- {
- // TODO: Add your command handler code here
- m_JobListDlg.SetSelectItemStatus( FILE_STATE_READY ) ;
- m_JobListDlg.StartTransmitFile( ) ;
- }
- void CMainFrame::OnBackStop()
- {
- // TODO: Add your command handler code here
- m_JobListDlg.m_Transmit.SetStopSign( false ) ;
- m_JobListDlg.SetSelectItemStatus( FILE_STATE_STOP ) ;
- }
- BOOL CMainFrame::LoadDefaultSite()
- {
- char szPath[MAX_PATH] ;
- GetCurExePath ( szPath ) ;
- strcat( szPath , DEFAULT_SITE_FILENAME ) ;
- memset( &m_CurSiteInfo , 0 , sizeof( m_CurSiteInfo ) ) ;
- CFile file ;
- if( !file.Open( szPath , CFile::modeRead ) )
- return false ;
- UINT iRead = 0 ;
- try
- {
- iRead = file.Read( &m_CurSiteInfo , sizeof( m_CurSiteInfo ) ) ;
- }
- catch( CFileException * e )
- {
- e->Delete( ) ;
- file.Close() ;
- memset( &m_CurSiteInfo , 0 , sizeof( m_CurSiteInfo ) ) ;
- return false ;
- }
- if( iRead != sizeof( m_CurSiteInfo ) )
- {
- file.Close() ;
- memset( &m_CurSiteInfo , 0 , sizeof( m_CurSiteInfo ) ) ;
- return false ;
- }
- else
- {
- file.Close() ;
- return true ;
- }
- return true ;
- }
- BOOL CMainFrame::SaveDefaultSite()
- {
- char szPath[MAX_PATH] ;
- GetCurExePath ( szPath ) ;
- strcat( szPath , DEFAULT_SITE_FILENAME ) ;
- CFile file ;
- if( !file.Open( szPath , CFile::modeWrite | CFile::modeCreate ) )
- return false ;
- try
- {
- file.Write( &m_CurSiteInfo , sizeof( m_CurSiteInfo ) ) ;
- }
- catch( CFileException * e )
- {
- e->Delete() ;
- file.Close() ;
- memset( &m_CurSiteInfo , 0 , sizeof( m_CurSiteInfo ) ) ;
- return false ;
- }
- file.Close() ;
- return true ;
- }
- void CMainFrame::GetCurExePath(char *szPath)
- {
- char CurPath[MAX_PATH] ;
- char driver[MAX_PATH] , path[MAX_PATH] , name[MAX_PATH] , ext[MAX_PATH] ;
- ::GetModuleFileName( NULL , CurPath , MAX_PATH ) ;
- _splitpath( CurPath , driver , path , name , ext ) ;
- _makepath( szPath , driver , path , NULL , NULL ) ;
- }
- BOOL CMainFrame::ConnectDefaultSite()
- {
- if( strlen( m_CurSiteInfo.host ) == 0 )
- return false ;
- //connect default site .
- m_ViewWndInfo.pFtpDirView->ConnectFtp( &m_CurSiteInfo ) ;
- return true ;
- }
- void CMainFrame::OnBackSelall()
- {
- // TODO: Add your command handler code here
- m_JobListDlg.m_ListCtrl.SelectAllItem() ;
- }
- void CMainFrame::OnBackStopall()
- {
- // TODO: Add your command handler code here
- m_JobListDlg.m_Transmit.SetStopSign( false ) ;
- m_JobListDlg.StopAllTransmitTask( ) ;
- }