Bitmaps question(s)

This is a discussion on Bitmaps question(s) within the Windows Programming forums, part of the Platform Specific Boards category; Hi, does anybody know how to find the dimensions of a bitmap in this example? The following is what I ...

  1. #1
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052

    Bitmaps question(s)

    Hi, does anybody know how to find the dimensions of a bitmap in this example?
    The following is what I want to do:
    Code:
    HBITMAP hbitmap = (HBITMAP)LoadImage(hinstance, "bitmap.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
    HBITMAP old_hbitmap = (HBITMAP)SelectObject(image_dc, hbitmap);
    
    BitBlt(hdc, 25, 25, bitmap_x, bitmap_y, image_dc, 0, 0, SRCCOPY); /* Before I can do this
    function call, I need the bitmap_x and bitmap_y to store the width and height of the bitmap.
    How do I find this information? */
    Also, in my function call to LoadImage(), I say that the filename of the bitmap is "bitmap.bmp". Can I replace this with an address of a bitmap? For example, replacing it with "C:\Images\bitmap.bmp" (or would that have to be "C:\\images\\bitmap.bmp, even though its not a dos or console app?)

    Thnaks for your help

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,859
    >>Can I replace this with an address of a bitmap? For example, replacing it with "C:\Images\bitmap.bmp"

    yes.

    to get the image size
    BITMAP Bitmap;
    GetObject(hBitmap,sizeof(BITMAP),&Bitmap);

    width=Bitmap.bmWidth;
    "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

  3. #3
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    >>BITMAP Bitmap;

    Did you mean HBITMAP Bitmap;?

  4. #4
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Oh, and Thanks

  5. #5
    Programming is fun, mkay?
    Join Date
    Oct 2001
    Posts
    490

    Lightbulb He was correct...

    He didn't mean HBITMAP, BITMAP also exists.
    Website(s): http://www16.brinkster.com/trifaze/

    E-mail: trifaze_mattu@lycos.com

    ---------------------------------
    C++ Environment: MSVC++ 6.0; Dev-C++ 4.0/4.1
    DirectX Version: 9.0b
    DX SDK: DirectX 8.1 SDK

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 06:36 AM
  2. DX9 Not Displaying Bitmaps
    By Sentral in forum Game Programming
    Replies: 9
    Last Post: 01-31-2006, 05:35 AM
  3. Several Questions, main one is about protected memory
    By Tron 9000 in forum C Programming
    Replies: 3
    Last Post: 06-02-2005, 08:42 AM
  4. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 09:44 AM
  5. questions questions questions.....
    By mfc2themax in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 08-14-2001, 08:22 AM

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