-
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,
-
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...
-
Re: Resource Files
How do I identify them since they have no filenames?
I have about 50 of them.
-
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.
-
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,
-
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.