Results 1 to 6 of 6

Thread: Resource Files

  1. #1

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950

    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

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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.

  3. #3

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950

    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

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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.

  5. #5

    Thread Starter
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950

    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

  6. #6
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594

    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
  •  



Click Here to Expand Forum to Full Width