char buf[128];
MCI_OPEN_PARMS mciOpen;
MCIERROR       mciError; //设置可打开的文件的类型为mp3
mciOpen.lpstrDeviceType= "mpegvideo";    mciOpen.lpstrElementName= "f:\\新建文件夹\\李贞贤-独一无二.mp3"; mciError = mciSendCommand(0,MCI_OPEN,MCI_OPEN_TYPE   |   MCI_OPEN_ELEMENT,(DWORD)&mciOpen);
if(mciError)
{
mciGetErrorString(mciError,buf,128);
MessageBox("Send MCI_PLAY command faild","ERROR");
return;
} UINT   DeviceID   =   mciOpen.wDeviceID;
MCI_PLAY_PARMS mciPlay;
mciError   =   mciSendCommand(DeviceID, MCI_PLAY, 0, 
(DWORD)   (LPMCI_PLAY_PARMS)&mciPlay);  //MCI_DGV_PLAY_REPEAT, 要 #include "Digitalv.h" if(mciError)   

mciGetErrorString(mciError,buf,128);     
MessageBox("send MCI_PLAY command failed", "ERROR");   
return;   
}   这个是播放音乐的!你可以写在任意一个函数里,然后执行这个函数就可以了