Loadfromfile or not?

This is a discussion on Loadfromfile or not? within the Windows Programming forums, part of the Platform Specific Boards category; Mostly, I'm interested in opinions for owner drawn controls and skins. Which method, MakeIntresource or loading directly is best? I ...

  1. #1
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252

    Loadfromfile or not?

    Mostly, I'm interested in opinions for owner drawn controls and skins. Which method, MakeIntresource or loading directly is best? I like using intresource since you don't need to worry about graphics being removed from folders, being edited or deleted, though how wise is it to pack all of the graphics inside an executable? Speed wise, I can't detect any difference (at least nothing noticeable by the naked eye).

  2. #2
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    Posts
    1,627
    I don't think there is a difference. But if there is, it's so trivial, that you don't need to worry about it, as you are only loading them once. (I think) If there is a difference, loading from resources is probably faster.
    If you are worried about size, you could try stuffing your bitmaps in a resource-only DLL, and load them from there. But putting them in the executable is the best option. (unless you have a file size limit, use the DLL)
    A class that doesn't overload all operators just isn't finished yet. -- SmugCeePlusPlusWeenie
    A year spent in artificial intelligence is enough to make one believe in God. -- Alan J. Perlis

  3. #3
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    Thanks for your opinion, Yarin. With the textures packed with the executable it's only 3mbs, so it isn't all that large. I was mostly curious to see if there were some performance issues to consider.

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,856
    As long as you handle load fails (null handles etc) you should not have a problem either way.

    I tend to use load from resource, so the images can not be removed / replaced / resized.
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

  5. #5
    Madly in anger with you
    Join Date
    Nov 2005
    Posts
    211
    I'd think including them as resources would be better performance wise than including them as files, since it's almost always faster to access data in memory than it is to access it on disk.

    as far as I know, Windows versions < Vista lack I/O prioritization, meaning that by avoiding heavy disk operations you'll also be ensuring efficient operation on all versions of Windows.

    http://www.microsoft.com/whdc/Driver/priorityio.mspx

    Intel Core 2 Quad Q6600 @ 2.40 GHz
    3072 MB PC2-5300 DDR2
    2 x 320 GB SATA (640 GB)
    NVIDIA GeForce 8400GS 256 MB PCI-E

  6. #6
    Registered User
    Join Date
    Dec 2006
    Location
    Scranton, Pa
    Posts
    252
    Thanks again, I appreciate the opinions. Looks like I'll go with loading from resources.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. LoadFromFile() causes Windows 98 to freeze?
    By MidnightlyCoder in forum Windows Programming
    Replies: 8
    Last Post: 03-17-2006, 01:23 PM
  2. LoadFromFile() from a txt
    By Snoopy104 in forum C++ Programming
    Replies: 6
    Last Post: 03-14-2006, 09:05 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21