Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
LBitmapBase::SetHandle
#include "ltwrappr.h"
L_INT LBitmapBase::SetHandle(pBitmapHandle, bFreePrev=TRUE)
pBITMAPHANDLE pBitmapHandle; |
/* pointer to a LEAD bitmap handle */ |
L_BOOL bFreePrev; |
/* flag that indicates whether to free the previous bitmap */ |
Attaches a new LEAD bitmap handle to the LBitmapBase class object.
Parameter |
Description |
|
pBitmapHandle |
Pointer to a LEAD bitmap handle that describes the bitmap to be attached to this object. This pointer will be invalidated if the function is successful, you can pass NULL if you only want to detach the current bitmap handle from the object. |
|
bFreePrev |
Flag that indicates whether to free the previous bitmap handle before attaching the new one. Possible values are: |
|
|
Value |
Meaning |
|
TRUE |
Free the previous bitmap handle before attaching the new one. |
|
FALSE |
Do not free the previous bitmap handle before attaching the new one. |
Returns
SUCCESS |
The function was successful. |
< 1 |
An error occurred. Refer to Return Codes. |
Comments
Use this function to attach a new LEAD bitmap handle to this LBitmapBase class object. This function will call the LBitmapBase::StartChanging and LBitmapBase::EndChanging member functions before and after setting the bitmap handle.
Required DLLs and Libraries
LTDIS 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: |
LBitmapBase::GetHandle, LBitmapBase::StartChanging, LBitmapBase::EndChanging, Class Members |
Example
L_INT LBitmapBase__SetHandleExample() { L_INT nRet; LBitmapBase MyBitmap; BITMAPHANDLE SomeBitmapHandle; nRet =L_InitBitmap(&SomeBitmapHandle, sizeof(SomeBitmapHandle),50, 50, 8); if(nRet !=SUCCESS) return nRet; nRet =MyBitmap.Load(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\bitmap1.cmp")); if(nRet !=SUCCESS) return nRet; //1-free the bitmap nRet =MyBitmap.SetHandle(0,TRUE); if(nRet !=SUCCESS) return nRet; nRet =MyBitmap.Load(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\bitmap1.cmp")); if(nRet !=SUCCESS) return nRet; //2-Set another LEAD bitmap handle and free the previous one nRet =MyBitmap.SetHandle(&SomeBitmapHandle,TRUE); if(nRet !=SUCCESS) return nRet; nRet =MyBitmap.Load(TEXT("%UserProfile%\\My Documents\\LEADTOOLS Images\\bitmap1.cmp")); if(nRet !=SUCCESS) return nRet; //3-attach new bitmap without freeing the previous one nRet =MyBitmap.SetHandle(&SomeBitmapHandle,FALSE); if(nRet !=SUCCESS) return nRet; return SUCCESS; }