GeniusDlg.cpp
资源名称:FTP总集.rar [点击查看]
上传用户:tjfeida
上传日期:2013-03-10
资源大小:1917k
文件大小:6k
源码类别:
Ftp客户端
开发平台:
Visual C++
- // GeniusDlg.cpp : implementation file
- //
- /*********************************************
- **该文件是属于WolfFTP工程中的。如果有什么问题
- **请联系
- ** tablejiang@21cn.com
- **或者访问
- ** http://wolfftp.51.net
- **以得到最新的支持。
- *********************************************/
- #include "stdafx.h"
- #include "quickftp.h"
- #include "GeniusDlg.h"
- #include "Windows.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CGeniusDlg dialog
- CGeniusDlg::CGeniusDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CGeniusDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CGeniusDlg)
- // NOTE: the ClassWizard will add member initialization here
- //}}AFX_DATA_INIT
- }
- void CGeniusDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CGeniusDlg)
- // NOTE: the ClassWizard will add DDX and DDV calls here
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CGeniusDlg, CDialog)
- //{{AFX_MSG_MAP(CGeniusDlg)
- ON_WM_LBUTTONDOWN()
- ON_WM_PAINT()
- ON_WM_ERASEBKGND()
- ON_WM_LBUTTONDBLCLK()
- ON_WM_RBUTTONDOWN()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CGeniusDlg message handlers
- void CGeniusDlg::OnOK()
- {
- // TODO: Add extra validation here
- //CDialog::OnOK();
- }
- void CGeniusDlg::OnCancel()
- {
- // TODO: Add extra cleanup here
- //CDialog::OnCancel();
- }
- BOOL CGeniusDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // TODO: Add extra initialization here
- //it need new SDK . And it only apply in win2000 system.
- /*
- // Set WS_EX_LAYERED on this window
- SetWindowLong( m_hWnd , GWL_EXSTYLE , GetWindowLong(m_hWnd , GWL_EXSTYLE) | WS_EX_LAYERED );
- // Make this window 70% alpha
- SetLayeredWindowAttributes( m_hWnd , 0 , (255 * 70) / 100, LWA_ALPHA);
- */
- ShowWindow( SW_HIDE ) ;
- RECT rect ;
- BITMAP bm ;
- m_BackBmp.LoadBitmap( IDB_BITMAP_GENIUS ) ;
- m_BackBmp.GetBitmap( &bm ) ;
- //set window pos .
- GetWindowRect( &rect ) ;
- rect.left = ::GetSystemMetrics(SM_CXSCREEN) - 50 ;
- rect.top = 10 ;
- rect.right = rect.left + bm.bmWidth ;
- rect.bottom = rect.top + bm.bmHeight ;
- MoveWindow( &rect , true ) ;
- m_iHeight = bm.bmHeight ;
- m_iWidth = bm.bmWidth ;
- ShowWindow( SW_SHOW ) ;
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CGeniusDlg::OnLButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- PostMessage(WM_NCLBUTTONDOWN,HTCAPTION,MAKELPARAM(point.x,point.y));
- CDialog::OnLButtonDown(nFlags, point);
- }
- void CGeniusDlg::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
- // TODO: Add your message handler code here
- // Do not call CDialog::OnPaint() for painting messages
- }
- BOOL CGeniusDlg::DestroyWindow()
- {
- // TODO: Add your specialized code here and/or call the base class
- m_BackBmp.DeleteObject( ) ;
- return CDialog::DestroyWindow();
- }
- BOOL CGeniusDlg::OnEraseBkgnd(CDC* pDC)
- {
- // TODO: Add your message handler code here and/or call default
- CDialog::OnEraseBkgnd(pDC);
- //draw the bitmap on erase .
- CDC memDC ;
- memDC.CreateCompatibleDC( pDC ) ;
- CBitmap * pOldBmp = memDC.SelectObject( &m_BackBmp ) ;
- pDC->BitBlt( 0 , 0 , m_iWidth , m_iHeight , &memDC ,
- 0 , 0 , SRCCOPY ) ;
- memDC.SelectObject( pOldBmp ) ;
- return true ;
- }
- BOOL CGeniusDlg::SplitterWindow()
- {
- CDC memdc ;
- CClientDC dc( this ) ;
- //make background
- RECT rect ;
- CBrush Brush ;
- ::SetRect( &rect , 0 , 0 , m_iWidth , m_iHeight ) ;
- Brush.CreateSolidBrush( RGB( 10 , 5 , 5 ) ) ;
- dc.FillRect( &rect , &Brush ) ;
- memdc.CreateCompatibleDC( &dc ) ;
- CBitmap* pBak= memdc.SelectObject( &m_BackBmp ) ;
- //split window move.
- for(int i=0;i<m_iHeight/2+1;i++)
- {
- dc.BitBlt (0 , 0 , m_iWidth , i+1 , &memdc , 0 , m_iHeight/2-i , SRCCOPY);
- dc.BitBlt (0 , m_iHeight-i , m_iWidth , i , &memdc , 0 , m_iHeight/2 , SRCCOPY);
- Sleep(10);
- }
- dc.BitBlt( 0 , 0 , m_iWidth , m_iHeight , &memdc ,
- 0 , 0 , SRCCOPY ) ;
- memdc.SelectObject( pBak ) ;
- Brush.DeleteObject( ) ;
- return true ;
- }
- LRESULT CGeniusDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
- {
- // TODO: Add your specialized code here and/or call the base class
- switch( message )
- {
- case GENIUS_WND_SPLIT_MSG :
- {
- SplitterWindow( ) ;
- }
- break ;
- default :
- break ;
- }
- return CDialog::DefWindowProc(message, wParam, lParam);
- }
- void CGeniusDlg::SetTransmitWnd(HWND hWnd)
- {
- m_hTransmitWnd = hWnd ;
- }
- void CGeniusDlg::OnLButtonDblClk(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- if( ::IsWindowVisible( m_hTransmitWnd ) )
- {
- ::ShowWindow( m_hTransmitWnd , SW_HIDE ) ;
- }
- else
- {
- ::ShowWindow( m_hTransmitWnd , SW_SHOW ) ;
- }
- CDialog::OnLButtonDblClk(nFlags, point);
- }
- void CGeniusDlg::SetMainWnd(CWnd *pWnd)
- {
- m_pMainWnd = pWnd ;
- }
- void CGeniusDlg::OnRButtonDown(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- CPoint myPoint ;
- myPoint = point ;
- ClientToScreen( &myPoint ) ;
- CMenu PopMenu ;
- PopMenu.LoadMenu( IDR_MAINFRAME ) ;
- CMenu *pPopMenu = PopMenu.GetSubMenu( 5 ) ;
- pPopMenu->EnableMenuItem( IDR_REMOTE_UPLOAD , MF_DISABLED | MF_GRAYED) ;
- pPopMenu->TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON , myPoint.x , myPoint.y , m_pMainWnd ) ;
- CDialog::OnRButtonDown(nFlags, point);
- }