胸怀天下 脚踏实地  


#include<windows.h>
#include<mmsystem.h>
//using namespace std;
int WINAPI WinMain(HINSTANCE hInstance,HINSTANCE hPreInstance,PTSTR szCmdLine,int iCmdShow)
{
// MessageBox(NULL,TEXT("hello"),"",MB_OK);


 mciSendString(" set cdaudio door open",NULL,0,0);
 int ret=MessageBox(NULL,"光驱已弹出,是否关闭?","",MB_YESNO);
 if(ret==IDYES)
 {
  mciSendString(" set cdaudio door closed wait",NULL,0,NULL);
 }
 else
 {
  
 }
}

//播放歌方法1

/* bool n=PlaySound(TEXT("e:\\离歌.wav"),NULL,SND_FILENAME|SND_SYNC|SND_LOOP);
  if(n==FALSE)
  {
    MessageBox(NULL,TEXT("打开失败"),"",MB_OK);
  }
  MessageBox(NULL,TEXT("hello"),"",MB_OK);*/

//方法2

mciSendString("play d:\\水手.mp3","",NULL,NULL);

posted on 2009-06-19 21:11  icey  阅读(369)  评论(0编辑  收藏  举报