Thread: CBitmap

  1. #1
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130

    CBitmap

    Please tell me I'm too dumb to find it in the MSDN. Maybe a cold and programming don't mix. I just don't get it...


    Using VC6 SP5 MFC, I have a CBitmap object constructed from a file. I need a copy of said object to modify it without touching the original. So how hard can it be to create a copy of an object ?

    Copy constructor ? Nope.
    Assignment operator ? Nope.
    Initialization method taking anything I could cast a CBitmap into ? Nope.

    WTF ?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  2. #2
    Unregistered
    Guest
    that's mfc for you, that and no DIB class wrapper.

    Here's a <i>suggestion</i> (sorry API):

    use 'LoadImage' to return an HBITMAP (ensure LR_SHARED flag is set in last param of LoadImage).

    Use 'CopyImage' to get a copy of the image.

    Use 'DeleteObject' on original HBITMAP.

    Use 'FromHandle ' member fn of CBitmap to return CBitmap obj.

    The returned CBitmap object should contain a copy of the file bitmap.

    Does that help?

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,130
    I'll give it a try, sounds better than anything I could find

    Thanks.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  2. GDI + problem
    By cfrost in forum Windows Programming
    Replies: 8
    Last Post: 08-31-2004, 01:49 PM
  3. Serial CBitmap
    By okinrus in forum Windows Programming
    Replies: 1
    Last Post: 04-23-2004, 12:38 AM
  4. CBitmap + big images = bad?
    By dug in forum Windows Programming
    Replies: 18
    Last Post: 06-28-2003, 11:53 PM
  5. MFC:how to use CBitmap to draw ...?
    By L.O.K. in forum Windows Programming
    Replies: 0
    Last Post: 12-13-2002, 06:05 AM