• 大小: 12.42MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-06-13
  • 语言: 其他
  • 标签: 源码  directshow  

资源简介

基于directShow,打造全能播放器系列之二——简易播放器的补充 源码 对应博客地址: http://blog.csdn.net/harvic880925/article/details/7987798# 此博文仅供交流,转载请标明出处,谢谢

资源截图

代码片段和文件信息

#include “stdafx.h“
#include “NiceSlider.h“

IMPLEMENT_DYNAMIC(CNiceSliderCtrl CSliderCtrl)


BEGIN_MESSAGE_MAP(CNiceSliderCtrl CSliderCtrl)
//{{AFX_MSG_MAP(CNiceSliderCtrl)
ON_WM_LBUTTONDOWN()
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONUP()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()


void CNiceSliderCtrl::OnLButtonDown(UINT nFlags CPoint point) 
{
m_bDragging = true;
m_bDragChanged = false;
SetCapture();
SetFocus();
if (SetThumb(point))
{
m_bDragChanged = true;
PostMessageToParent(TB_THUMBTRACK);
}
}


void CNiceSliderCtrl::onmousemove(UINT nFlags CPoint point) 
{
if (m_bDragging)
{
if (SetThumb(point))
{
m_bDragChanged = true;
PostMessageToParent(TB_THUMBTRACK);
}
}
else
{
CSliderCtrl::onmousemove(nFlags point);
}
}

void CNiceSliderCtrl::OnLButtonUp(UINT nFlags CPoint point) 
{
if(m_bDragging)
{
m_bDragging = false;
::ReleaseCapture();
if (SetThumb(point))
{
PostMessageToParent(TB_THUMBTRACK);
m_bDragChanged = true;
}
if (m_bDragChanged)
{
PostMessageToParent(TB_THUMBPOSITION);
m_bDragChanged = false;
}
}
else
{
CSliderCtrl::OnLButtonUp(nFlags point);
}
}


bool CNiceSliderCtrl::SetThumb(const CPoint& point)
{
const int nMin = GetRangeMin();
const int nMax = GetRangeMax()+1;
CRect rc;
GetChannelRect(rc);
double dPos;
double dCorrectionFactor = 0.0;
if (Getstyle() & TBS_VERT) 
{
// note: there is a bug in GetChannelRect it gets the orientation of the rectangle mixed up
dPos = (double)(point.y - rc.left)/(rc.right - rc.left);
}
else
{
dPos = (double)(point.x - rc.left)/(rc.right - rc.left);
}
// This correction factor is needed when you click inbetween tick marks
// so that the thumb will move to the nearest one
dCorrectionFactor = 0.5 *(1-dPos) - 0.5 *dPos;
int nNewPos = (int)(nMin + (nMax-nMin)*dPos + dCorrectionFactor);
const bool bChanged = (nNewPos != GetPos());
if(bChanged)
{
SetPos(nNewPos);
}
return bChanged;
}

void CNiceSliderCtrl::PostMessageToParent(const int nTBCode) const
{
CWnd* pWnd = GetParent();
if(pWnd) pWnd->PostMessage(WM_HSCROLL (WPARAM)((GetPos() << 16) | nTBCode) (LPARAM)GetSafeHwnd());
}



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

     文件     130560  2012-09-17 14:40  Player\Debug\Player.exe

     文件    1430216  2012-09-17 14:40  Player\Debug\Player.ilk

     文件    4041728  2012-09-17 14:40  Player\Debug\Player.pdb

     文件       8452  2012-09-17 14:40  Player\Player\Debug\BuildLog.htm

     文件         67  2012-09-17 14:40  Player\Player\Debug\mt.dep

     文件      15374  2012-09-14 10:49  Player\Player\Debug\NiceSlider.obj

     文件       1196  2012-09-14 10:51  Player\Player\Debug\Player.exe.embed.manifest

     文件       1260  2012-09-14 10:51  Player\Player\Debug\Player.exe.embed.manifest.res

     文件       1120  2012-09-17 14:40  Player\Player\Debug\Player.exe.intermediate.manifest

     文件      43336  2012-09-17 14:40  Player\Player\Debug\Player.obj

     文件   25034752  2012-09-14 10:49  Player\Player\Debug\Player.pch

     文件      23456  2012-09-17 11:01  Player\Player\Debug\Player.res

     文件     110759  2012-09-17 14:40  Player\Player\Debug\PlayerDlg.obj

     文件     466726  2012-09-14 10:49  Player\Player\Debug\stdafx.obj

     文件    1141760  2012-09-17 14:40  Player\Player\Debug\vc90.idb

     文件    2314240  2012-09-17 14:40  Player\Player\Debug\vc90.pdb

     文件       2249  2010-07-29 09:39  Player\Player\NiceSlider.cpp

     文件        715  2010-07-29 09:39  Player\Player\NiceSlider.h

     文件      59112  2012-09-17 11:00  Player\Player\Player.aps

     文件       1932  2012-09-14 10:20  Player\Player\Player.cpp

     文件        471  2012-09-13 15:25  Player\Player\Player.h

     文件       5449  2012-09-17 11:00  Player\Player\Player.rc

     文件       5774  2012-09-13 15:08  Player\Player\Player.vcproj

     文件       1423  2012-09-17 15:34  Player\Player\Player.vcproj.20120611-1228.Administrator.user

     文件      19060  2012-09-17 14:40  Player\Player\PlayerDlg.cpp

     文件       2676  2012-09-17 14:40  Player\Player\PlayerDlg.h

     文件       2873  2012-09-13 14:32  Player\Player\ReadMe.txt

    .......     21630  2003-07-24 09:52  Player\Player\res\Player.ico

     文件        362  2012-09-13 14:32  Player\Player\res\Player.rc2

     文件        954  2012-09-14 16:00  Player\Player\resource.h

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

评论

共有 条评论