Article View: borland.public.cppbuilder.nativeapi
Article #13008Re: Play wav file from code - Load JPEG's from Resource Too?
From: Patrick
Date: Tue, 04 Nov 2003 17:13
Date: Tue, 04 Nov 2003 17:13
76 lines
3081 bytes
3081 bytes
Ed,
This post gives me hope that JPG files could be saved as resources and
loaded to TJPEG.
Any ideas? Using BCB 5.
I've been very unsuccessful at doing this, so I have large BMP files in the
res files where JPG's have adequate quality for my purposes. Really don't
want a lot of image files in the program directory to be lost or corrupted.
--
Regards, Patrick Leabo pleabo@comcast.net
"Ed Mulroy [TeamB]" <dont_email_me@bitbuc.ket> wrote in message
news:3f9c8805$1@newsgroups.borland.com...
>
> How you do that depends upon if it is an external *.wav file or one you
have
> built into your program as a resource.
>
>
> If you want to play the sound contained in an external file, FILENAME.WAV
>
> PlaySound("filename.wav", NULL, SND_FILENAME);
>
>
> If you want to play a sound that you have built into your program as a
> resource.
>
> Put this declaration at the top of your source file to tell it of this
> variable which was created by the compiler's startup code.
>
> -----------------
> extern HINSTANCE _hInstance;
> -----------------
>
> Create a resource file, we'll call it SOUND.RC, containing this and add
that
> file name to the project.
> -----------------
> #include "sound.rh"
>
> BIG_SOUND WAVE "filename.wav"
> -----------------
>
>
> You have created a header file named SOUND.RH containing this
> -----------------
> #define BIG_SOUND 1 /* or whatever number you want to give it */
> -----------------
>
> Your source file should include SOUND.RH so that it knows of the #define
for
> BIG_SOUND
>
> You can then give this command to play the wav file you have built into
your
> program.
>
> -----------------
> PlaySound(MAKEINTRESOURCE(BIG_SOUND),
> _hInstance, SND_RESOURCE);
>
> -----------------
>
> For more things you can do with PlaySound, look in the compiler-supplied
> help on Windows.
>
> . Ed
>
> > Martin C wrote in message
> > news:3f9c7595@newsgroups.borland.com...
> >
> > How I can play wave file programmatically ?
>
>
Technical Details
Message-ID:
<3fa7de42$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3f9c7595@newsgroups.borland.com> <3f9c8805$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,1888f9f1253de96f X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-11-04 09:41:11 PST Reply-To: "Patrick" <pleabo@comcast.net> From: "Patrick" <pleabo@comcast.net> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f9c7595@newsgroups.borland.com> <3f9c8805$1@newsgroups.borland.com> Subject: Re: Play wav file from code - Load JPEG's from Resource Too? Date: Tue, 4 Nov 2003 10:13:36 -0700 Lines: 78 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 NNTP-Posting-Host: 68.84.207.206 Message-ID: <3fa7de42$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1067966018 68.84.207.206 (4 Nov 2003 09:13:38 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail