delphi播放mp3

var   
        mciOpenParms:   TMCI_Open_Parms;   
        m_MCIDeviceID:   MCIDEVICEID;  

procedure TForm1.FormCreate(Sender: TObject);
var
mciPlayParms:MCI_PLAY_PARMS;
ret:   integer;
begin
try
  begin
 mciOpenParms.lpstrDeviceType:='';   
      mciOpenParms.lpstrElementName   :=   'xxxx.mp3';   
      mciSendCommand(0,MCI_OPEN,MCI_OPEN_ELEMENT,DWORD(@mciOpenParms));
      m_MCIDeviceID   :=   mciOpenParms.wDeviceID;   
       mciPlayParms.dwCallback   :=   Form1.Handle;   
      mciPlayParms.dwFrom   :=   0;   
      ret   :=   mciSendCommand(m_MCIDeviceID,MCI_PLAY,MCI_FROM   or   MCI_NOTIFY,integer(@mciPlayParms));
      end;
except

end;
end; 

Posted in 软件开发 by 傻猫 at December 25, 2012.
Tags: 音乐, mp3

添加新评论