CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    May 1999
    Location
    Malaysia
    Posts
    99

    What is handle??????

    Im trying to put a bitmap onto my button. However, one of the function I use needs a parameter that is "handle" type, which is the bitmap's handle.

    Now, my question is, what is the handle of the bitmap. I have a bitmap file named "flower.bmp", its ID is IDB_FLOWER, but what is its handle??????


    smebody pls help me

    ty

  2. #2
    Join Date
    May 1999
    Posts
    96

    Re: What is handle??????

    Construct CBitmapButton class. Then Call Create function and then call LoadBitmap() function to put bitmap on a button. See CBitmapButton overview to check out how to put a bitmap on a button. Its self explanatory.




  3. #3
    Join Date
    Jun 1999
    Posts
    6

    Re: What is handle??????

    First you have to create an CBitmap object, then load the bitmap source to this CBitmap and then load this CBitmap to your CButton. Like this

    CBitmap m_CBitmap;

    m_CBitmap.LoadBitmap(IDB_FLOWER);
    YourButtonControl.SetBitmap(HANDLE(m_CBitmap));




  4. #4
    Join Date
    Jun 1999
    Posts
    6

    Re: What is handle??????

    Sorry, it should be HBITMAP not HANDLE.

    YourButtonControl.SetBitmap(HBITMAP(m_CBitmap));






  5. #5
    Join Date
    Apr 1999
    Posts
    306

    Re: What is handle??????

    operator HBITMAP( ) const;

    Return Value

    If successful, a handle to the Windows GDI object represented by the CBitmap object; otherwise NULL.

    Remarks

    Use this operator to get the attached Windows GDI handle of the CBitmap object. This operator is a casting operator, which supports direct use of an HBITMAP object.

    Use like this:

    HBITMAP handle;
    handle = (HBITMAP)my_bitmap;

    or just (HBITMAP)my_bitmap;

    Regards,
    ric


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured