www.pudn.com > SOAVI2BMP_ACTIVEMOVIE.rar > BalanceDlg.cpp, change:2007-05-23,size:2439b


// BalanceDlg.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "soavi2bmp.h" 
#include "BalanceDlg.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
#include "SOAVI2BMPDlg.h" 
 
///////////////////////////////////////////////////////////////////////////// 
// CBalanceDlg dialog 
 
 
CBalanceDlg::CBalanceDlg(CWnd* pParent /*=NULL*/) 
	: CDialog(CBalanceDlg::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CBalanceDlg) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
	ASSERT( pParent != NULL ); 
	m_pAmovie = &((CSOAVI2BMPDlg *)pParent)->m_ctlActiveMovie; 
} 
 
 
void CBalanceDlg::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CBalanceDlg) 
	DDX_Control(pDX, IDC_SLIDER_BALANCE, m_sld); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CBalanceDlg, CDialog) 
	//{{AFX_MSG_MAP(CBalanceDlg) 
	ON_WM_HSCROLL() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CBalanceDlg message handlers 
 
BOOL CBalanceDlg::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
 
	//设置音量滑块的最小值、标度和当前位置等 
	m_sld.SetRange(-10000,10000); 
	m_sld.SetTicFreq(2000); 
	m_sld.SetLineSize(500); 
	m_sld.SetPageSize(2000); 
	m_sld.SetPos(m_pAmovie->GetBalance());  
 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CBalanceDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)  
{ 
	// TODO: Add your message handler code here and/or call default 
	 
	//在用户拖动或点击滑快控件时,将所作用的改变立即作用于ActiveMovie控件 
	CSliderCtrl *pSlider = (CSliderCtrl *)pScrollBar; 
	int nVolume = pSlider->GetPos(); 
	 
	//设置当前的声道平衡位置 
	m_pAmovie->SetBalance( nVolume ); 
 
	CDialog::OnHScroll(nSBCode, nPos, pScrollBar); 
} 
 
void CBalanceDlg::SetBalance(CActiveMovie3* pAmovie) 
{//提供给类外部的使用者的编程接口方法 
 
   m_pAmovie=pAmovie; 
 
   //如果未加载任何媒体文件,则音量调节对话框不可用 
 
    //ActiveMovie控件的CurrentState属性返回控件的当前值,-1表示未加载任何//媒体文件,此时弹出出错信息 
 
   if(m_pAmovie->GetCurrentState()!=-1) 
 
   { 
 
       DoModal(); 
 
   } 
 
   else 
 
   { 
 
       MessageBox("音频设备尚未加载,请先打开一个媒体文件"); 
 
   } 
 
}