I'm having so much trouble with LoadImage()!!!

This is a discussion on I'm having so much trouble with LoadImage()!!! within the Windows Programming forums, part of the Platform Specific Boards category; I have had no end of trouble in displaying a bitmap. I would so appreciate it if someone could help, ...

  1. #1
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    801

    I'm having so much trouble with LoadImage()!!!

    I have had no end of trouble in displaying a bitmap. I would so appreciate it if someone could help, i have tried everything. I have attached a zip file containing my resource file rsrc.rc, my source file, bitmap.cpp and my header file resource1.h along with the bitmap i am trying to display. Currently the path to the bitmap in the .rc file is to the A: drive so you might want to change it and you might want to use a different bitmap. But basically i just can't get any bitmap to be displayed at all. If anyone could create themselves a project, copy my code in, build/compile it and see why it won't work i would be so grateful. I can get it to compile and it displays the "managed to load bitmap" message ok but then nothing is displayed.

    I am using bloodshed dev C++.

    Thanks
    Attached Files Attached Files

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Replace the line in your window procedure:

    HBITMAP hbmrocket = NULL;

    with:

    static HIBITMAP hbmrocket;

    Or keep the same line but make it global ie move it out of the window procedure.

    If you do not declare your variables as static when used in that way then each time the window procedure is called ( a lot ) the variable will be re-initialised.

    I haven't looked at the rest of your code nor have I compiled it but that looks like it will at least allow your bitmap handle to persist between calls.

    Good luck.

  3. #3
    Funniest man in this seat minesweeper's Avatar
    Join Date
    Mar 2002
    Posts
    801

    Thank You SOOOOOOO Much!!!!

    It worked!!!!!!!!! I can't thank you enough!!!! I had spent hours trying to figure out what was wrong!!!!

    Thanks again!!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. LoadImage()
    By Gordon in forum Windows Programming
    Replies: 15
    Last Post: 12-22-2007, 05:16 PM
  2. Replies: 6
    Last Post: 01-03-2007, 02:02 PM
  3. trouble scanning in... and link listing
    By panfilero in forum C Programming
    Replies: 14
    Last Post: 11-21-2005, 11:58 AM
  4. C++ program trouble
    By senrab in forum C++ Programming
    Replies: 7
    Last Post: 04-29-2003, 11:55 PM
  5. LoadImage doesn't work when my program is accesing the hardrive
    By pinkcheese in forum Windows Programming
    Replies: 2
    Last Post: 04-20-2002, 12:39 AM

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