LBitmapList::SetHandle

#include "ltwrappr.h"

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

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

Parameters

HBITMAPLIST hList

The handle to the bitmap list to be set.

LPBLISTINFO pBListInfo

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

L_BOOL 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

Platforms

Win32, x64.

See Also

Example

L_INT LBitmapList__SetHandleExample(HWND ) 
 
{ 
   L_INT nRet; 
   LBitmapList BitmapList, SecondBitmapList; 
   LBitmapBase Bitmap; 
   HBITMAPLIST hBitmapList; 
 
   nRet =BitmapList.Create (); 
   if(nRet !=SUCCESS) 
      return nRet; 
   // load three images and insert them in the list 
   nRet =Bitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp")), 0,ORDER_BGR); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =BitmapList.InsertItem (&Bitmap); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =Bitmap.Load(MAKE_IMAGE_PATH(TEXT("image2.cmp")), 0,ORDER_BGR); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =BitmapList.InsertItem (&Bitmap); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =Bitmap.Load(MAKE_IMAGE_PATH(TEXT("ImageProcessingDemo\\Image3.cmp")), 0,ORDER_BGR); 
   if(nRet !=SUCCESS) 
      return nRet; 
   nRet =BitmapList.InsertItem (&Bitmap); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   // 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); 
    
   return SUCCESS; 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.