Solved

HELP - audio in win32 c++ console app

Posted on 2001-09-05
2
374 Views
Last Modified: 2008-01-09
ok, i have already refered to all the comment about using playsound() espcially this article
http://www.experts-exchange.com/jsp/qShow.jsp?qid=20066222

this is my code:

#include <MMSYSTEM.H>
#include <windows.h>


void main()
{
  PlaySound("chimes.wav",NULL,SND_FILENAME|SND_LOOP|SND_ASYNC);
}




the above code is not functionning!
Here are the errors:
c:\program files\microsoft visual studio\vc98\include\mmsystem.h(113) : error C2146: syntax error : missing ';' before identifier 'MMVERSION'

c:\program files\microsoft visual studio\vc98\include\mmsystem.h(113) : fatal error C1004: unexpected end of file found

**i have already added the "winmm.lib" into project/settings -> link -> object/library modules
, but there is no diffrent


can somebody help me out, and pls tell me what type of wav
file that can play(i mean kHz, bit, stereo/mono, wavelength)


Thanks
0
Comment
Question by:Knight_G
2 Comments
 
LVL 2

Accepted Solution

by:
smitty1276 earned 100 total points
Comment Utility
Have you tried including windows.h FIRST?  I would assume MMSYSTEM.H needs all of the Windows data types, etc., to be defined before hand... especially considering that this line is the one that generated your error:

typedef UINT MMVERSION;

UINT is a Microsoft thing.
0
 

Author Comment

by:Knight_G
Comment Utility
wow, it really works!!!
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now