-
C++ code
I have this code but the umemba, loser, and winner sounds wont play...can somone help me...
#include <windows.h>
#include<iostream>
using namespace std;
DWORD WINAPI dwThread(LPVOID);
DWORD WINAPI dwUmemba(LPVOID);
DWORD WINAPI dwLoser(LPVOID);
DWORD WINAPI dwWinner(LPVOID);
int main()
{
HANDLE hThread;
while(hThread)
{
hThread=CreateThread(NULL,1,dwThread,0,1,NULL);
WaitForSingleObject(hThread,1);
}
char lname[34];
int number;
char name[35];
cout<<"Please enter your name."<<endl;
cin>>name;
cout<<"enter 3 or 4"<<endl;
cin>>number;
if(number==3)
{
HANDLE hThread;
while(hThread)
{
hThread=CreateThread(NULL,1,dwUmemba,0,1,NULL);
WaitForSingleObject(hThread,1);
}
}
else if (number==4)
{
HANDLE hThread;
while(hThread)
{
hThread=CreateThread(NULL,1,dwLoser,0,1,NULL);
WaitForSingleObject(hThread,1);
}
}
else
{
HANDLE hThread;
while(hThread)
{
hThread=CreateThread(NULL,1,dwWinner,0,1,NULL);
WaitForSingleObject(hThread,1);
}
PlaySound("winner.wav",NULL,SND_FILENAME | SND_ASYNC);
}
cout<<"You loser"<<name<<endl;
cout<<"please enter your last name"<<endl;
cin>>lname;
return 0;
}
DWORD WINAPI dwThread(LPVOID)
{
PlaySound("tetris.wav",NULL,SND_FILENAME);
ExitThread(0);
}
DWORD WINAPI dwUmemba(LPVOID)
{
PlaySound("umemba.wav",NULL,SND_FILENAME);
ExitThread(0);
}
DWORD WINAPI dwLoser(LPVOID)
{
PlaySound("loser.wav",NULL,SND_FILENAME);
ExitThread(0);
}
DWORD WINAPI dwWinner(LPVOID)
{
PlaySound("winner.wav",NULL,SND_FILENAME);
ExitThread(0);
}
-
Of course, it won't play the sound for umeba and loser because you didn't call the function play sound.
Similar Threads
-
By Noryk Rekrap in forum Talk to the Editors
Replies: 3
Last Post: 08-23-2007, 03:56 PM
-
Replies: 8
Last Post: 04-03-2002, 07:41 PM
-
Replies: 150
Last Post: 03-04-2002, 06:40 PM
-
By Steven Bell in forum .NET
Replies: 260
Last Post: 06-01-2001, 04:32 PM
-
Replies: 1
Last Post: 09-22-2000, 09:11 AM
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|