#include <windows.h>
#include <mmsystem.h>

int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
 int choice = 0;
 do
 {
  OPENFILENAME ofn;
  char szFile[MAX_PATH];
  ZeroMemory(&ofn, sizeof(ofn));
  ofn.lStructSize = sizeof(ofn);
  ofn.lpstrFile = szFile;
  ofn.lpstrFile[0] = TEXT('\0');
  ofn.nMaxFile = sizeof(szFile);
  ofn.lpstrFilter = TEXT("*.wav\0*.wav\0");
  ofn.nFilterIndex = 1;
  ofn.lpstrFileTitle = NULL;
  ofn.nMaxFileTitle = 0;
  ofn.lpstrInitialDir = NULL;
  ofn.Flags = OFN_EXPLORER | OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
  if(GetOpenFileName(&ofn))
  {
   PlaySound(szFile, NULL, SND_FILENAME | SND_SYNC);
   choice = MessageBox(NULL, TEXT("wav播放完毕,是否重新选择wav文件?"), TEXT("播放完毕"), MB_YESNO | MB_ICONQUESTION | MB_DEFBUTTON1);
   if(choice == IDYES)
    choice = 1;
   else
    choice = 0;
  }
 }while(choice);
 return 0;
}

WavPlayer