Thread: Loading Bitmaps

  1. #1
    Neandrake
    Guest

    Loading Bitmaps

    I'm not trying to make a game, but I want to learn about loading bitmaps onto windows in visual c++. Does anyone know of a place to learn more about this? Thanks for any help

  2. #2
    Neandrake
    Guest
    Well, I got some code going:

    Code:
    	hBitmap=(HBITMAP)LoadBitmap(myInstance,MAKEINTRESOURCE(IDD_BMPMAP));
    	BitBlt(
    hehe, not much, eh? I have a RECT var which I described the top/bottom/left/right properties to and I'm trying to assign it to the first argument of BitBlt(). How do I make the MyRect thing into a drawing area? I'm confused with BeginPaint(). Does anyone have any ideas?

  3. #3
    Neandrake
    Guest

    GAR! GAR!

    Well, let me update that code:

    Code:
    	hBitmap=(HBITMAP)LoadBitmap(myInstance,MAKEINTRESOURCE(IDD_BMPMAP));
    	BitBlt(hDC,50,50,64,320,(HDC)hBitmap,0,0,SRCCOPY);
    It displays nothing. What am I doing wrong? The bitmap is 64x320. Any ideas?

  4. #4
    Registered User DutchStud's Avatar
    Join Date
    Oct 2001
    Posts
    43
    try making another dc using CreateCompatibleDC() and load your bitmap into it. then bitblt the compatible dc into hdc.

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Try a search. I have posted all the code you need previously and do not want to do so again.

    PS CreateCompatibleBitmap() needs a HDC for the second to be compatible with. But you will find this in a search.

    Use GetObject() and a BITMAP struc to find the size of the image on the fly.

    You will need a paint function to see anything.
    "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. Problem Loading Bitmaps in Allegro
    By LiNeAr in forum Game Programming
    Replies: 1
    Last Post: 08-15-2005, 04:12 PM
  2. Loading bitmaps with createfile() +CreateDIBSection
    By Stevo in forum Windows Programming
    Replies: 7
    Last Post: 05-13-2004, 09:22 PM
  3. Loading bitmaps without win32
    By /Muad'Dib\ in forum C++ Programming
    Replies: 0
    Last Post: 04-05-2004, 02:47 PM
  4. Loading Resource Bitmaps
    By Xterria in forum Windows Programming
    Replies: 10
    Last Post: 11-11-2001, 01:12 PM
  5. loading Bitmaps
    By Stealth in forum C++ Programming
    Replies: 2
    Last Post: 10-24-2001, 09:01 PM