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

📄 geodropview.cpp

📁 类似flashget下载工具代码 本来想在完善了上传的
💻 CPP
字号:
// GeoDropView.cpp : implementation file
//

#include "stdafx.h"
#include "MyInsaneBT.h"
#include "GeoDropView.h"
#include "MainFrm.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CGeoDropView

IMPLEMENT_DYNCREATE(CGeoDropView, CView)

CGeoDropView::CGeoDropView()
{
}

CGeoDropView::~CGeoDropView()
{
}


BEGIN_MESSAGE_MAP(CGeoDropView, CView)
	//{{AFX_MSG_MAP(CGeoDropView)
	ON_WM_MOUSEMOVE()
	ON_WM_LBUTTONUP()
	ON_WM_LBUTTONDOWN()
	ON_WM_CREATE()
	ON_WM_ERASEBKGND()
	ON_WM_TIMER()

	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CGeoDropView drawing

void CGeoDropView::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
    CRect rect;
	GetWindowRect(&rect);
	const int m = 100;
	float yy;
    int h = rect.Height();
	yy = (float)h / m;
	static int oo = 0;
	static CPoint pt1,pt2;
	int p1x = pt1.x =0;
	int p1y =pt1.y = h-yy*oo;

    int p2x = pt2.x = rect.Width()-2;
	int p2y = pt2.y = h-yy*oo;
    oo++;
	pDC->MoveTo(pt1);
	pDC->LineTo(pt2);
    
	
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CGeoDropView diagnostics

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

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

/////////////////////////////////////////////////////////////////////////////
// CGeoDropView message handlers
int CGeoDropView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
   	if (CView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
    m_dropTarget.Register(this);
    //SetTimer(1,1000,NULL);
	return 0;

}

DROPEFFECT CGeoDropView::OnDragEnter(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point)
{
    FORMATETC fmtetc;
	fmtetc.cfFormat=CF_TEXT;
	fmtetc.dwAspect=DVASPECT_CONTENT;
	fmtetc.ptd=NULL;
	fmtetc.tymed=TYMED_HGLOBAL;
	fmtetc.lindex=-1;
	hObj= pDataObject->GetGlobalData(CF_TEXT,&fmtetc);

	return CView::OnDragEnter(pDataObject, dwKeyState, point);

}

DROPEFFECT CGeoDropView::OnDragOver(COleDataObject* pDataObject, DWORD dwKeyState, CPoint point) 
{
	// TODO: Add your specialized code here and/or call the base class
	if(hObj!=NULL)
		return DROPEFFECT_MOVE;
	else
		return DROPEFFECT_NONE;

	//return CView::OnDragOver(pDataObject, dwKeyState, point);
}


BOOL CGeoDropView::OnDrop(COleDataObject* pDataObject, DROPEFFECT dropEffect, CPoint point) 
{

	//FORMATETC fmtetc;
    /*
	if(hObj!=NULL)
	{   

		pDataObject->BeginEnumFormats();
		while(pDataObject->GetNextFormat(&fmtetc))
		{
			CFile *file=new CFile();
			file=pDataObject->GetFileData(CF_TEXT,&fmtetc);
			if(file->GetLength()>0x4c)
			{
				long lOffset=file->Seek(0x4c,CFile::begin);
				char buf[2];
				buf[1]=0x0;
				m_Comment.Empty();
				file->Read(buf,1);
				while(buf[0]!=NULL)
				{
					m_Comment+=buf;
					file->Read(buf,1);
				}
				delete file;
				int nLength=m_Comment.GetLength();
				m_Comment=m_Comment.Left(nLength-4);
				break;
			}
		}
	*/
	m_Url=CString((LPSTR)GlobalLock(hObj));
	GlobalUnlock(hObj);
	GlobalFree(hObj);
	//m_bAddJob=TRUE;
	PURL downURL = new URL();
    downURL->m_url = m_Url;
	

	//下载通知 
	CMainFrame* pFrm = (CMainFrame*)AfxGetApp()->m_pMainWnd;
	pFrm->SendMessage(WM_STASRTDOWN,0,(LPARAM)downURL);
	return CView::OnDrop(pDataObject, dropEffect, point);
}

BOOL CGeoDropView::CreateView(LPCTSTR szClassName,CRect rect,CWnd* pParentWnd,UINT nID,DWORD dwStyle)
{

   	return Create(szClassName,NULL,dwStyle,rect,pParentWnd,nID);
     
}

BOOL CGeoDropView::OnEraseBkgnd(CDC* pDC)
{    
	
     CRect nRect;
	 GetClientRect(nRect);

	 CDC *mdc=new CDC;
	 mdc->CreateCompatibleDC(pDC);
	 CBitmap *bitmap=new CBitmap;

	 bitmap->LoadBitmap(IDB_BITMAP_DOWN);

     mdc->SelectObject(bitmap);
	 pDC->BitBlt(0,0,nRect.right,nRect.bottom,mdc,0,0,SRCCOPY);
	 
	 if(mdc)
		delete mdc;
	 if(bitmap)
		delete bitmap;
	
	pDC->SetBkMode(TRANSPARENT);
    return CView::OnEraseBkgnd(pDC);

}

void CGeoDropView::OnLButtonDown(UINT nFlags, CPoint point)
{
    m_TempPoint=point;

	SetCapture();
	CView::OnLButtonDown(nFlags, point);
   

}


void CGeoDropView::OnLButtonUp(UINT nFlags, CPoint point)
{
   
    m_bIsLButtonUp = TRUE;
	ReleaseCapture();
	CView::OnLButtonUp(nFlags, point);

}

void CGeoDropView::OnMouseMove(UINT nFlags, CPoint point)
{
    if(nFlags & MK_LBUTTON)
	{
		CPoint nPoint;
		::GetCursorPos(&nPoint);
		m_mousepos.x=nPoint.x-m_TempPoint.x;
		m_mousepos.y=nPoint.y-m_TempPoint.y;
		GetParent()->SendMessage(WM_DROPWINPOS,0,(LPARAM)&m_mousepos);
		m_bMove=TRUE;

	}

	CView::OnMouseMove(nFlags, point);
}


void CGeoDropView::OnTimer(UINT nIDEvent)
{
    //Invalidate();
   
}


⌨️ 快捷键说明

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