Thread: I just want a bitmap in my window

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    75

    I just want a bitmap in my window

    Plz dont tell me to go to the faq I was told a long time ago to go there to look up this but if it had have helpemd me then I wouldnt be back would I so heres my question to make things real simple I'm gonna start a new project in DevC++ and let it create a window for me so dont worry about that(I'm not usually that lazy but I want to get to the point)


    anyway all I want is some simple code to display a bitmap or jpg or any kind of image inside my window and possibly to a position where I want it and thats all surely that cant be hard I mean there has to be a few ways to do it and I'm after the easiest way so if it's ok could somebody plz take a little time to explain to me how this is done



    thank you very much



    Cheers


    Stealth
    If I knew what You know I wouldnt be here.............. Stealth

    Ecliptic Entertainment
    http://www.ecliptic-entertainment.com/

  2. #2
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Without using some other library (as far as I know) you can't use anything but a BMP.

    Are you confident using HDC's?
    Have you got code for a framebuffer/screenDC?
    Can you do the repaint?

    Look at this thread for these bits of code
    "Errors with resource bitmaps....HELP PLEASE!"

    Start with a simple bmp created in the resource editor and move up.

    Load it with
    hBitmap=LoadBitmap(hInstance,MAKEINTRECOURCE(IDD_M YBMP);

    Create your HDC's, load and select the hBitmap in to a temp HDC. StretchBlt() / BitBlt() the temp HDC to the framebuffer, call your function to update the screenDC. Call a paint with InvalidateRect()
    "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
    Registered User
    Join Date
    Oct 2001
    Posts
    75
    ok man thanks for the help I'll check that out but theres a few things there that I dont understand like HDC? hmmm all i want to do is like lets say put up a picture that I would use for a button or something maybe ,
    well I'm sure I'll figure it out anyway thanks again man I'll see what I can do ok


    cheers


    Stealth
    If I knew what You know I wouldnt be here.............. Stealth

    Ecliptic Entertainment
    http://www.ecliptic-entertainment.com/

  4. #4
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    HDC = Handle to a Device Context

    Simply a blank sheet to draw to.

    A button has a HDC that you can GetDC() with. Then draw to the HDC and use BitBlt() to draw the changed HDC back to the button.
    (BitBlt() is same size StretchBlt() is bigger/ smaller).

    Its not simple. It requires a large framework under the drawing to allow fast updates to the screen. Think of it as the same as the first callback you wrote.

    PS Should have an extra ) and a spelling error in the previous post.

    hBitmap=LoadBitmap(hInstance,MAKEINTRESOURCE( IDD_MYBMP));
    "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
    Registered User
    Join Date
    Oct 2001
    Posts
    75
    hmm thats quite interesting does that mean that the HDC is like the first place where the button is drawn then it is drawn to the screen and then it is changed again by the HDC and then drawn again like updating the screen using to um things to draw on?
    thats quite cool actually I'm gonna like this stuff cheers man I just cant check that out right now I'll have to come back and read it later


    thanks again


    cheers


    Stealth
    If I knew what You know I wouldnt be here.............. Stealth

    Ecliptic Entertainment
    http://www.ecliptic-entertainment.com/

  6. #6
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Posts
    937
    For God's sake use punctuation!
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  7. #7
    Registered User
    Join Date
    Oct 2001
    Posts
    75
    lol

    if u talking to me I'm sorry mate I'm a bit lazy (not usually) but lately yeah
    If I knew what You know I wouldnt be here.............. Stealth

    Ecliptic Entertainment
    http://www.ecliptic-entertainment.com/

  8. #8
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Location
    Budapest
    Posts
    463
    >> I'm sorry mate I'm a bit lazy (not usually) but lately yeah

    ...or you're just a Bogumil Hrabal fan, isn't it? ;°)

  9. #9
    Registered User
    Join Date
    Oct 2001
    Posts
    75
    what the hell?
    If I knew what You know I wouldnt be here.............. Stealth

    Ecliptic Entertainment
    http://www.ecliptic-entertainment.com/

  10. #10
    Normal vector Carlos's Avatar
    Join Date
    Sep 2001
    Location
    Budapest
    Posts
    463
    Hrabal is (was, as he died a few years ago) a great czech writer, who did not use any puntuation signs, thus giving his thoughts an incredible lilt.

    Well, sometimes very hard to interprete, his books might cause physical pain and brain damage those who are only familiar with cartoons and hollywood-movies . (even I got headache after 10 pages, though being a very tough european guy :P)

    Was that your intention, too?
    ...or what the hell?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  2. Linking OpenGL in Dev-C++
    By linkofazeroth in forum Game Programming
    Replies: 4
    Last Post: 09-13-2005, 10:17 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM
  5. OpenGL and Windows
    By sean345 in forum Game Programming
    Replies: 5
    Last Post: 06-24-2002, 10:14 PM