MFC实现多任务多线程软件


mfc实现多任务多线程下载软件源代码,支持断点续传
资源截图
代码片段和文件信息
// BmpProgCtrl.cpp : implementation file
//

#include “stdafx.h“
#include “listdemo.h“
#include “BmpProgCtrl.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CBmpProgCtrl

CBmpProgCtrl::CBmpProgCtrl()
{
m_nLower = 0;
m_nUpper = 100;
m_nStep = 10;
m_nPos = 0;
pDCBack = new CDC;
pDCFore = new CDC;
bmpBack.LoadBitmap(IDB_BACK);
bmpFore.LoadBitmap(IDB_FORE);
}

CBmpProgCtrl::~CBmpProgCtrl()
{
delete pDCBack;
delete pDCFore;
}


BEGIN_MESSAGE_MAP(CBmpProgCtrl CStatic)
//{{AFX_MSG_MAP(CBmpProgCtrl)
ON_WM_PAINT()
ON_WM_TIMER()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CBmpProgCtrl message handlers

void CBmpProgCtrl::SetRange(int nLower int nUpper)
{
if(nUpper > nLower)
{
m_nLower = nLower;
m_nUpper = nUpper;
}
else
{
m_nLower = nUpper;
m_nUpper = nLower;
}

}

int CBmpProgCtrl::SetPos(int nPos)
{
if(m_nLower <= nPos && m_nUpper >= nPos)
{
m_nPos = nPos;
return 1;
}
return 0;
}

int CBmpProgCtrl::OffsetPos(int nPos)
{
CRect tempRect = m_rect;
tempRect.left = m_length*m_rect.Width();
m_nPos += nPos;
if(m_nPos>m_nUpper)
{
m_nPos = m_nUpper;
InvalidateRect(&tempRect);
return 0;
}
InvalidateRect(&tempRect);
return 1;

}

int CBmpProgCtrl::SetStep(int nStep)
{
if(nStep>0)
{
m_nStep = nStep;
return 1;
}
return 0;
}

int CBmpProgCtrl::StepIt()
{
CRect tempRect = m_rect;
tempRect.left = m_length*m_rect.Width();
m_nPos += m_nStep;
if(m_nPos>m_nUpper)
{
m_nPos = m_nUpper;
InvalidateRect(&tempRect);
return 0;
}
InvalidateRect(&tempRect);
return 1;
}

void CBmpProgCtrl::OnPaint() 
{
m_length = (float)m_nPos/(m_nUpper-m_nLower);
CPaintDC dc(this);
GetClientRect(&m_rect);
pDCBack->CreateCompatibleDC(&dc);
pDCFore->CreateCompatibleDC(&dc);

bmpBack.GetBitmap(&bmback);
bmpFore.GetBitmap(&bmfore);
pDCBack->Selectobject(bmpBack);

dc.StretchBlt(00m_rect.Width()m_rect.Height()pDCBack00bmback.bmWidthbmback.bmHeightSRCCOPY);

(CBitmap*)pDCFore->Selectobject(bmpFore);
dc.StretchBlt(00m_rect.Width()*m_lengthm_rect.Height()pDCFore00bmfore.bmWidth*m_lengthbmfore.bmHeightSRCCOPY);

pDCBack->DeleteDC();
pDCFore->DeleteDC();
}

int CBmpProgCtrl::GetPos()
{
return m_nPos;
}

void CBmpProgCtrl::GetRange(int &lower int &upper)
{
lower = m_nLower;
upper = m_nUpper;
}



 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2634  2007-09-09 20:32  v3BmpProgCtrl.cpp

     文件       1561  2007-09-09 20:32  v3BmpProgCtrl.h

     文件       7984  2007-09-05 16:06  v3Client.cpp

     文件       2159  2007-09-05 16:06  v3Client.h

     文件          0  2007-09-11 15:21  v3Debug.~xiajie~

     文件      20833  2007-09-09 20:32  v3DebugBmpProgCtrl.obj

     文件      32534  2007-09-05 17:50  v3DebugClient.obj

     文件      75837  2007-09-05 16:01  v3DebugCSVLineParser.obj

     文件      63220  2007-09-05 17:50  v3DebugDownLoad.obj

     文件     311384  2007-09-11 22:57  v3DebugListDemo.exe

     文件     695992  2007-09-11 22:57  v3DebugListDemo.ilk

     文件      38380  2007-09-09 21:12  v3DebugListDemo.obj

     文件    5497884  2007-09-05 16:01  v3DebugListDemo.pch

     文件     934912  2007-09-11 22:57  v3DebugListDemo.pdb

     文件      37200  2007-09-11 22:57  v3DebugListDemo.res

     文件     112099  2007-09-11 15:44  v3DebugListDemoDlg.obj

     文件      48339  2007-09-05 16:01  v3DebugListItem.obj

     文件     111611  2007-09-08 22:22  v3DebugListReport.obj

     文件      76367  2007-09-05 17:50  v3DebugMutl.obj

     文件     101868  2007-09-05 17:50  v3DebugPublic.obj

     文件      35387  2007-09-05 17:50  v3DebugSocketFtp.obj

     文件      54252  2007-09-05 17:50  v3DebugSocketHttp.obj

     文件     105557  2007-09-05 16:01  v3DebugStdAfx.obj

     文件     394240  2007-12-18 22:39  v3Debugvc60.idb

     文件     503808  2007-09-11 15:44  v3Debugvc60.pdb

     文件      18615  2007-09-05 16:09  v3DownLoad.cpp

     文件       6046  2007-09-05 16:09  v3DownLoad.h

     文件      56044  2007-12-18 22:39  v3ListDemo.aps

     文件       2504  2007-12-18 22:39  v3ListDemo.clw

     文件       2392  2007-09-08 14:43  v3ListDemo.cpp

............此处省略44个文件信息

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)