Thread: HBITMAP in Class

  1. #1
    Registered User
    Join Date
    Sep 2004
    Posts
    20

    HBITMAP in Class

    Hello. So...I wanna To load 3 bitmap`s in one function. Ant after that Select it from another function I did like that:

    [lalala.h]

    class Bitmap {
    HBITMAP hBitmap;
    public:
    void Function1();
    void Function2();
    );

    [lalala.cpp]

    void Function1()
    {
    hBitmap = (HBITMAP)LoadImage(0, "a.bmp", IMAGE_BITMAP, 0, 0,
    LR_LOADFROMFILE);
    }

    void Function2()
    {
    BITMAP BMP;
    HDC hDC;

    GetObject(hBitmap, sizeof(BMP), &BMP);
    HDC BMPDC = CreateCompatibleDC(NULL);
    hDC = GetDC(hBtn);
    SelectObject(BMPDC, hBitmap);
    BitBlt(hDC, 0, 0, 10, 10, BMPDC, 0, 0, SRCCOPY);
    ReleaseDC(hBtn, hDC);

    DeleteDC(BMPDC);
    DeleteObject(hBitmap);
    }


    It`s just an example because real code a bit more confusion, but whatever... So I can`t SelectObject hBitmap :/ if I load hBitmap in Function2() it selects find... what`s wrong here? THNX C ya (:
    Butterfly sweep can make torando in another side of world

  2. #2
    Registered User Rare177's Avatar
    Join Date
    May 2004
    Posts
    214
    i dont know the solution to your problem but i can help you by saying use code tags when posting code on this forum, this way some people may answer your question
    Good Help Source all round
    Good help for win programmers
    you will probably find something in here
    this thing also helps

    if you have never tried any of the above then maybe you should, they help alot

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. matrix class
    By shuo in forum C++ Programming
    Replies: 2
    Last Post: 07-13-2007, 01:03 AM
  2. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  3. Creating a database
    By Shamino in forum Game Programming
    Replies: 19
    Last Post: 06-10-2007, 01:09 PM
  4. structure vs class
    By sana in forum C++ Programming
    Replies: 13
    Last Post: 12-02-2002, 07:18 AM