www.pudn.com > 1littlebox.rar > volumcontrol.cpp


// volumcontrol.cpp: implementation of the volumcontrol class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#include "stdafx.h" 
#include "volumcontrol.h" 
 
#ifdef _DEBUG 
#undef THIS_FILE 
static char THIS_FILE[]=__FILE__; 
#define new DEBUG_NEW 
#endif 
 
////////////////////////////////////////////////////////////////////// 
// Construction/Destruction 
////////////////////////////////////////////////////////////////////// 
 
volumcontrol::volumcontrol() 
{ 
	m_max=0; 
	m_min=0; 
} 
 
volumcontrol::~volumcontrol() 
{ 
 
} 
 
void volumcontrol::Create(CWnd *pwnd,DWORD type1,DWORD type2,DWORD type3) 
{ 
	m_wnd=pwnd; 
	m_hMixer = NULL; 
	MIXERCAPS m_mxcaps; 
	::ZeroMemory(&m_mxcaps, sizeof(MIXERCAPS)); 
	if (::mixerGetNumDevs() != 0) 
	{ 
		if (::mixerOpen(&m_hMixer,0,(DWORD)m_wnd->m_hWnd,NULL,MIXER_OBJECTF_MIXER | CALLBACK_WINDOW) 
			!= MMSYSERR_NOERROR) 
			return ; 
		if (::mixerGetDevCaps((UINT)m_hMixer, &m_mxcaps, sizeof(MIXERCAPS)) 
			!= MMSYSERR_NOERROR) 
			return ; 
	} 
	if (m_hMixer == NULL)	return ; 
	MIXERLINE mxl; 
	MIXERCONTROL mxc; 
	MIXERLINECONTROLS mxlc; 
	mxl.cbStruct = sizeof(MIXERLINE); 
	mxl.dwComponentType = type1; 
	if (::mixerGetLineInfo((HMIXEROBJ)m_hMixer, 
						   &mxl, 
						   MIXER_OBJECTF_HMIXER | 
						   MIXER_GETLINEINFOF_COMPONENTTYPE) 
		!= MMSYSERR_NOERROR)		return ; 
	if(type2!=-1) 
	{ 
		DWORD num=mxl.cConnections; 
		DWORD type=mxl.dwDestination;  
		for( DWORD i=0;i