MCI_OVLY_OPEN_PARMS Structure 结构中的成员 lpstrDeviceType的值

MCI 播放设备对应的文件类型在注册表中的位置 
lpstrDeviceType

Name or constant identifier of the device type. (The name of the device is typically obtained from the registry or SYSTEM.INI file.) If this member is a constant, it can be one of the values listed in MCI Device Types.

          MCI Device Types

MSDN

Name or constant identifier of the device type. (The name of the device is typically obtained from the registry or SYSTEM.INI file.) If this member is a constant, it can be one of the values listed in

The following values identify devices in MCI messages and structures:

ValueMeaning
MCI_ALL_DEVICE_IDAny device
MCI_DEVTYPE_ANIMATIONAnimation-playback device
MCI_DEVTYPE_CD_AUDIOCD audio device
MCI_DEVTYPE_DATDigital-audio tape device
MCI_DEVTYPE_DIGITAL_VIDEODigital-video playback device
MCI_DEVTYPE_OTHERUndefined device
MCI_DEVTYPE_OVERLAYVideo-overlay device
MCI_DEVTYPE_SCANNERScanner device
MCI_DEVTYPE_SEQUENCERMIDI sequencer device
MCI_DEVTYPE_VCRVideo-cassette recorder
MCI_DEVTYPE_VIDEODISCVideodisc player
MCI_DEVTYPE_WAVEFORM_AUDIO

Waveform-audio device

实在看不懂,好像9X时代的东东.最后终于在注册表中找到了.

HKEY_LOCAL_MACHINE/Software/Microsoft/Windows NT/CurrentVersion/MCI Extensions中有所有的文件类型,和相对应的播放设备。
MCI播放mp3的例子:

#include<windows.h>
#include<stdio.h>
#include<mmsystem.h>

#pragma comment(lib,"winmm.lib")

void main()
{
char buf[128];
//use mciSendString()
//mciSendString("play e://songs//把根留住.mp3",buf,sizeof(buf),NULL);
//mciSendString("play e://songs//zhj.mp3",buf,sizeof(buf),NULL);
char str[128] = {0 };
int i = 0;

//use mciSendCommand
MCI_OPEN_PARMS mciOpen;
MCIERROR mciError;
SetWindowText(NULL,"12345");
//mciOpen.lpstrDeviceType = (LPCTSTR)MCI_ALL_DEVICE_ID;
//mciOpen.lpstrDeviceType = "waveaudio"; //只能播放.wav文件
//mciOpen.lpstrDeviceType = "avivideo"; //*.avi
mciOpen.lpstrDeviceType = "mpegvideo";
//mciOpen.lpstrDeviceType = "sequencer";
mciOpen.lpstrElementName = "e://songs//zhj.mp3";
//mciOpen.lpstrElementName = "e://movie//first.avi";
//mciOpen.lpstrElementName = "c://winnt//media//Windows 登录音.wav";
mciError = mciSendCommand(0,MCI_OPEN,MCI_OPEN_TYPE | MCI_OPEN_ELEMENT,(DWORD)&mciOpen);
if(mciError)
{
mciGetErrorString(mciError,buf,128);
printf("send MCI_OPEN command failed:%s/n",buf);
return;
}
UINT DeviceID = mciOpen.wDeviceID ;
MCI_PLAY_PARMS mciPlay;

mciError = mciSendCommand(DeviceID,MCI_PLAY,0 ,(DWORD)&mciPlay);
if(mciError)
{
printf("send MCI_PLAY command failed/n");
return;
}

/*
while(1)
{
sprintf(str,"now playing/t%d/tseconds",i);
printf("%s/r",str);
i++;
Sleep(1000);
}
*/
}  

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值