得到WAV文件的长度
long getVideoLength (char *fileName)
{
MCI_OPEN_PARMS mciOpenParms;
MCI_STATUS_PARMS mciStatusParms;
DWORD Flags;
DWORD DeviceID;
mciOpenParms.wDeviceID=NULL;
mciOpenParms.lpstrElementName=fileName;
Flags=mciSendCommand(NULL,MCI_OPEN,MCI_OPEN_ELEMENT,(DWORD)(LPVOID)&mciOpenParms);
if (!Flags)
{
Flags=NULL;
DeviceID=mciOpenParms.wDeviceID;
mciStatusParms.dwItem=MCI_STATUS_LENGTH;
Flags=mciSendCommand(DeviceID,MCI_STATUS,MCI_STATUS_ITEM,(DWORD)(LPVOID)&mciStatusParms);
if (!Flags)
{
return (int)(mciStatusParms.dwReturn/1000);
mciSendCommand(DeviceID,MCI_CLOSE,NULL,NULL);
}
}
else
{
Application->MessageBoxA("不支持的文件格式","错误",MB_OK);
return 0;
}
}