Thread: Is this code correct?

  1. #1
    Registered User
    Join Date
    May 2003

    Is this code correct?


    I'm wanting to get a handle to a bitmap (not in a resource!) and I'm using:

    HBITMAP ButtonPic;


    Is this correct? Thanks!

  2. #2
    Kiss the monkey. CodeMonkey's Avatar
    Join Date
    Sep 2001
    Looks good to me. I think there might be an LR_FILENAME thing in there somewhere, too. But I think that should work. Does it?
    "If you tell the truth, you don't have to remember anything"
    -Mark Twain

  3. #3
    Registered User
    Join Date
    May 2003
    Well...that's the trouble . This is to put in with a custom button, which can have a resource of the bitmap or a handle to a file. Since I don't have a resource I'm doing it like this. But its not adding the bitmap to the button...

  4. #4
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Check the return value from LoadImage(). If the call works, it returns a handle, if not NULL. If it is returning a handle, then the problem is somewhere else, if it is returning NULL, call GetLastError() to find out why.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. my Dictionary removal code correct?
    By George2 in forum C# Programming
    Replies: 1
    Last Post: 05-17-2008, 08:45 AM
  2. True ASM vs. Fake ASM ????
    By DavidP in forum A Brief History of
    Replies: 7
    Last Post: 04-02-2003, 04:28 AM
  3. Seems like correct code, but results are not right...
    By OmniMirror in forum C Programming
    Replies: 4
    Last Post: 02-13-2003, 01:33 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. Replies: 4
    Last Post: 01-16-2002, 12:04 AM