LBitmapList::SetHandle

#include "ltwrappr.h"

L_VOID LBitmapList::SetHandle(hList, pBListInfo=NULL, bFree=TRUE)

HBITMAPLIST hList;

/* the handle to the bitmap list to be set */

LPBLISTINFO pBListInfo;

/* pointer to a structure */

L_BOOL bFree;

/* flag that indicates whether to destroy the old bitmap list */

Sets a new bitmap list handle for the bitmap list object.

Parameter

Description

hList

The handle to the bitmap list to be set.

pBListInfo

Optional pointer to a structure of type BLISTINFO that holds additional information about the passed bitmap list handle.

bFree

Flag that indicates whether to destroy the old bitmap list. Possible values are:

 

Value

Meaning

 

TRUE

Destroy the old bitmap list.

 

FALSE

Do not destroy the old bitmap list.

Returns

None

Comments

Pass FALSE for bFree if the class object is referencing another object's bitmap list.

In this case, the owner of the bitmap list should free it when it is no longer needed.

If an LBitmapList object is referencing another object's bitmap list, you can use this function to set the object's internal handle to NULL so it will not attempt to free the bitmap list when its destructor is called.

Required DLLs and Libraries

LTFIL

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

Class Members

Example

L_VOID BitmapListSamples(HWND )
{
   LBitmapList BitmapList, SecondBitmapList;
   LBitmapBase Bitmap;
   HBITMAPLIST hBitmapList;

   BitmapList.Create ();
   // load three images and insert them in the list
   Bitmap.Load(TEXT("image1.cmp"), 0,ORDER_BGR);
   BitmapList.InsertItem (&Bitmap);
   Bitmap.Load(TEXT("image2.cmp"), 0,ORDER_BGR);
   BitmapList.InsertItem (&Bitmap);
   Bitmap.Load(TEXT("image3.cmp"), 0,ORDER_BGR);
   BitmapList.InsertItem (&Bitmap);

   // get the internal handle
   hBitmapList = BitmapList.GetHandle ();
   // this will invalidate the original bitmaplist
   // You have to set the handle of the first list to NULL
   // so that when the SecondBitmapList is out of scope it will
   // destroy the object
   BitmapList.SetHandle (NULL, NULL, FALSE);
   // Attach the list to the second LBitmapList object
   SecondBitmapList.SetHandle (hBitmapList);
}