Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
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. |
Win32, x64.
See Also
Functions: |
Example
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 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; }