大家帮忙来看下为什么用MCI无法播放wav ( 积分: 100 )

  • 主题发起人 主题发起人 k4-1
  • 开始时间 开始时间
K

k4-1

Unregistered / Unconfirmed
GUEST, unregistred user!
下面这段代码是直接从MSDN中翻译过来的。为什么把这段代码放到button上,却播不出什么。大家帮忙看看好吗,自己是在弄不明白,水平太菜。先谢过了。
var
wDeviceID : UINT;
mciOpenParms : MCI_OPEN_PARMS;
mciPlayParms : MCI_PLAY_PARMS;
begin

mciOpenParms.lpstrDeviceType := 'waveaudio';
mciOpenParms.lpstrElementName := Pchar('d:/temp.wav');
mciSendCommand(0, MCI_OPEN,
MCI_OPEN_TYPE and MCI_OPEN_ELEMENT,
DWORD(@mciOpenParms));
wDeviceID := mciOpenParms.wDeviceID;
mciPlayParms.dwCallback := handle;
mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY,
DWORD(@mciPlayParms));


end;
 
下面这段代码是直接从MSDN中翻译过来的。为什么把这段代码放到button上,却播不出什么。大家帮忙看看好吗,自己是在弄不明白,水平太菜。先谢过了。
var
wDeviceID : UINT;
mciOpenParms : MCI_OPEN_PARMS;
mciPlayParms : MCI_PLAY_PARMS;
begin

mciOpenParms.lpstrDeviceType := 'waveaudio';
mciOpenParms.lpstrElementName := Pchar('d:/temp.wav');
mciSendCommand(0, MCI_OPEN,
MCI_OPEN_TYPE and MCI_OPEN_ELEMENT,
DWORD(@mciOpenParms));
wDeviceID := mciOpenParms.wDeviceID;
mciPlayParms.dwCallback := handle;
mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY,
DWORD(@mciPlayParms));


end;
 
此句参数中:
mciSendCommand(0, MCI_OPEN,
MCI_OPEN_TYPE and MCI_OPEN_ELEMENT,
DWORD(@mciOpenParms));
将 and 改为 or 就行了:
mciSendCommand(0, MCI_OPEN,
MCI_OPEN_TYPE or MCI_OPEN_ELEMENT,
DWORD(@mciOpenParms));
 
呵呵,谢谢了.是我太粗心了.
 
后退
顶部