Hi all,
I am writing a small app that stores an image and an MP3 file in the app itself as resources, which is used by the app after it is running.
I have tried to to read the resources using the FindResource() API but am having all sorts of trouble (LastError = 718h).
Does anyone have an example or perhaps some tips regarding this?
I look forward to hearing from you.
regards,
sharpe.
in the resource file, you assign a unique ID number, then refer to that ID
here is a simple example with a sound file...
http://www.masm32.com/board/index.php?action=dlattach;topic=15882.0;id=8764
in the ASM file, notice the EQUate
IDS_PMF EQU 1000
;
;
;
INVOKE PlaySound,IDS_PMF,hInstance,SND_RESOURCE
and, in the resource file...
#define IDS_PMF 1000
IDS_PMF WAVE DISCARDABLE "PMF.wav"
the resource text for a bitmap is very similar, except you use "BITMAP" instead of "WAVE"
Sweet, you just gave me another idea, nice.
But if I didn't want to play them, just access the raw data of the image and mp3, would find resource work?
INVOKE PlaySound... nice..
Thanks.
Here is an old MSDN article (1994) by Matt Pietrek: Peering Inside the PE: A Tour of the Win32 Portable Executable File Format (http://msdn.microsoft.com/en-us/library/ms809762.aspx). Scroll down about 3/4 of the way, and, there is a section that describes the PE File Resources. It's good stuff,...but, some serious overkill.
baltoro,
I know that article, awesome. I'll have a butchers.
Thanks!
Hi sharpe,
Why not to embed the image and the sound file into the executable? The trick is to convert binary files to MS COFF object modules to be linked with your project module.
Here is an example from MSDN: Using Resources (http://msdn.microsoft.com/en-us/library/ms648008(v=vs.85).aspx)
Hi sharpe,
Here is a resource example for you.
Hi Vortex, that's smashing, thanks very much!