Thread: Bitmaps question(s)

  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,868
    >>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: [email protected]

    ---------------------------------
    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, 05: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, 07: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, 07:22 AM