VC++播放音乐

#include <iostream.h>      
#include <windows.h>
#include "resource.h"
#include <mmsystem.h>

#pragma comment(lib,"winmm.lib")


void sound()
{
    PlaySound(MAKEINTRESOURCE(IDR_WAVE1),GetModuleHandle(NULL),SND_ASYNC);

// PlaySound(TEXT("Windows XP 启动.WAV"),ai,SND_FILENAME|SND_ASYNC);
   // PlaySound(MAKEINTRESOURCE(IDR_WAVE1),ai,SND_RESOURCE|SND_ASYNC);
}
void main()
{
sound();
}
resource.h
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Script2.rc
//
#define IDR_WAVE1                       101

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        102
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1000
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

posted @ 2009-08-13 12:05  BuildNewApp  阅读(332)  评论(0编辑  收藏  举报