|
-
Dec 7th, 2004, 04:49 PM
#1
Thread Starter
Frenzied Member
Resource Files
Hey,
I added a bunch of metafiles as resource files into my project.
I created a new folder under Resource Files in the Resource Files folder under the File View tab. (I'm using Visual Studio 6)
Now, how would I go about loading them into memory?
Up until now, they were loaded from the hard drive in a specific folder.
Here's the line of code that was responsible for loading the metafile into memory.
ifstream metastream( szMetafileName, ios::binary );
szMetafileName was an argument passed into the function.
I want to replace it with the location of the resource file.
Thanks,
Don't anthropomorphize computers -- they hate it
-
Dec 7th, 2004, 05:30 PM
#2
Re: Resource Files
Difficult. Resources are embedded directly into the exe and thus have no file name. You can load them (or rather map them) into memory using the FindResource, LoadResource and LockResource API calls.
Hmm... sounds like an opportunity for a streambuffer...
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 7th, 2004, 05:32 PM
#3
Thread Starter
Frenzied Member
Re: Resource Files
How do I identify them since they have no filenames?
I have about 50 of them.
Don't anthropomorphize computers -- they hate it
-
Dec 7th, 2004, 05:49 PM
#4
Re: Resource Files
They have resource IDs. You specified them in the resource editor, I suppose. IF, that is, you imported them as resource and not simply added them to the resource directory of the project.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 8th, 2004, 10:06 AM
#5
Thread Starter
Frenzied Member
Re: Resource Files
he he,
I did add them to the resource directory as oppose to importing them.
Can I access them that way as well or do I have to import them?
Thanks,
Don't anthropomorphize computers -- they hate it
-
Dec 8th, 2004, 12:43 PM
#6
Re: Resource Files
Well, as long as you don't import them, they're just that, entries in the project description file. Having nothing else to do with your project, as far as the IDE is concerned. No special handling, no anything. They're files in your source directory.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
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
|
Click Here to Expand Forum to Full Width
|