LBitmapBase::SetHandle

Summary

Attaches a new LEAD bitmap handle to the LBitmapBase class object.

Syntax

#include "ltwrappr.h"

L_INT LBitmapBase::SetHandle(pBitmapHandle, bFreePrev=TRUE)

Parameters

pBITMAPHANDLE 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.

L_BOOL 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

Value Meaning
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

Platforms

Win32, x64.

See Also

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(MAKE_IMAGE_PATH(TEXT("image1.cmp"))); 
   if(nRet !=SUCCESS) 
      return nRet; 
   //1-free the bitmap 
   nRet =MyBitmap.SetHandle(0,TRUE); 
   if(nRet !=SUCCESS) 
      return nRet; 
 
   nRet =MyBitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.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.SetHandle(0,TRUE); 
   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; 
} 
Help Version 22.0.2023.2.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.