Re: Sound advice

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Peteroid (peter_oliphant_at_msn.com)
Date: 05/29/04


Date: Fri, 28 May 2004 18:16:22 -0700


  Thanx for responding!

  I tried the code snipet below, and I get a lot of errors. After a little
experimentation, I've narrowed it down to not liking the inclusion of
"windows.h". It needs it to recognize PlaySound() and SND_FILENAME, but a
subset of the errors it gives with windows.h are as follows:

  C:\Program Files\Microsoft Visual Studio
.NET\Vc7\PlatformSDK\Include\ObjIdl.h(7385): error C2371: 'IDataObject' :
redefinition; different basic types

  C:\Program Files\Microsoft Visual Studio
.NET\Vc7\PlatformSDK\Include\ObjIdl.h(7894): error C2371: 'IMessageFilter' :
redefinition; different basic types

  c:\Program Files\Microsoft Visual Studio
.NET\Vc7\PlatformSDK\Include\ServProv.h(92): error C2872: 'IServiceProvider'
: ambiguous symbol
     :
     :
   etc.

  and other errors that look like just these same errors being repeated many
times. I'm doing a MANAGED windows program, is that the problem?

    [==Peter==]

  "William DePalo [MVP VC++]" <willd.no.spam@mvps.org> wrote in message
news:O3x3FfHREHA.3504@TK2MSFTNGP09.phx.gbl...
> "Peteroid" <peter_oliphant@msn.com> wrote in message
> news:%23I0V2AFREHA.2520@TK2MSFTNGP11.phx.gbl...
> > Can anybody point me to or give a simple source
> > example of a managed C++
> > application that can play a wav sound file?
>
> Yup, try this:
>
> #include <windows.h>
>
> #using <mscorlib.dll>
> using namespace System;
>
> int main()
> {
> Console::WriteLine(S"Play sound test ...");
>
> PlaySound("file.wav", 0, SND_FILENAME);
>
> return 0;
> }
>
> Change "file.wav" to be the full path to a multimedia file.
>
> > I know a little about playSound(), but it doesn't
> > seem to like to compile (even though it's 'recognized'
> > via type-ahead in the editor). Required header files
> > might be my problem, not sure...
>
> Compilers can be so picky ... :-)
>
> Seriously, it is often wise to post a _few lines_ of code and the
_exact_
> text of the error message you get from the compiler. More often than not
> someone here will be able to decipher it for you. And on those rare
> occasions when no one can spot the error, it can be escalated to someone
who
> does.
>
> Regards,
> Will
>
>



Relevant Pages