Hot to use resources in Visual C++?

This is a discussion on Hot to use resources in Visual C++? within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I'm a Visual C++ newbie(I know C++ on a high level, and I haven't programmed windows before, I just ...

  1. #1
    Misike
    Guest

    Hot to use resources in Visual C++?

    Hi, I'm a Visual C++ newbie(I know C++ on a high level, and I haven't programmed windows before, I just need Visual C++ for SDL), and I would like to know, how can I add resource files(images, and sounds) to my exe file, and how can I access these added files, as individual files!
    Please note, that I don't know anything about MFC and windows programming!

    Thanks in advance!

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    "Programming Windows" by Charles Petzold
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    A book is good advice but I'm sure you want something now. You use functions such as LoadIcon, LoadImage, LoadBitmap (this is better for resource files than LoadImage), LoadFont, and there are a couple others. You can find them all at msdn.miscrosoft.com.

    Code:
    HBITMAP MyImage = LoadBitmap(hInst, "MyResourceName");

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    LoadImage() is the latest version of LoadBitmap().

    Can only use BMP's not other image types in GDI (MS has added some in GDI++).

    To play sounds look for (suprisingly) PlaySound() or lookup Wave form audio (WM_WOM_OPEN msg's)
    "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

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 01:13 AM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 09:57 AM

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