日期:2014-05-17 浏览次数:20945 次
void C_mfc_vc6Dlg::OnButton1()
{
m_hMixer = NULL;
::ZeroMemory(&m_mxcaps, sizeof(MIXERCAPS));
if (m_nNumMixers != 0)
{
if (::mixerOpen(&m_hMixer,
0,
reinterpret_cast<DWORD>(this->GetSafeHwnd()),
NULL,
MIXER_OBJECTF_MIXER | CALLBACK_WINDOW)
!= MMSYSERR_NOERROR)
{
::MessageBox(this->GetSafeHwnd(), "mixerOpen failed", "", 0);
return;
}
if (::mixerGetDevCaps(reinterpret_cast<UINT>(m_hMixer),
&m_mxcaps, sizeof(MIXERCAPS))
!= MMSYSERR_NOERROR)
{
::MessageBox(this->GetSafeHwnd(), "mixerGetDevCaps failed", "", 0);
return;
}
}
if (m_hMixer == NULL)
{
::MessageBox(this->GetSafeHwnd(), "m_hMixer == NULL", "", 0);
return;
}
// get dwLineID
MIXERLINE mxl;
mxl.cbStruct = sizeof(MIXERLINE);
mxl.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_SPEAKERS;
if (::mixerGetLineInfo(reinterpret_cast<HMIXEROBJ>(m_hMixer),
&mxl,
MIXER_OBJECTF_HMIXER |
MIXER_GETLINEINFOF_COMPONENTTYPE)
!= MMSYSERR_NOERROR)
{
::MessageBox(this->GetSafeHwnd(), "mixerGetLineInfo failed", "", 0);
return;
}
char buf[128] = {0};
sprintf(buf, "%X, %d", mxl.dwLineID, mxl.dwLineID);
::MessageBox(0, mxl.szName, buf, 0);
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace _cs_test
{
public partial class Form1 : Form
{
public const uint MAXPNAMELEN = 32;
public const uint CALLBACK_WINDOW = 0x00010000;
public const uint MIXER_OBJECTF_MIXER = 0x00000000;
public const uint MMSYSERR_NOERROR = 0;
public const uint MIXERLINE_COMPONENTTYPE_DST_SPEAKERS = 4;
public const uint MIXER_OBJECTF_HANDLE = 0x80000000;
public const uint MIXER_OBJECTF_HMIXER = (MIXER_OBJECTF_HANDLE | MIXER_OBJECTF_MIXER);
public const uint MIXER_GETLINEINFOF_COMPONENTTYPE = 0x00000003;
&n