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

Platforms

Win32, x64.

See Also

Functions:

LBitmapBase::GetHandle, LBitmapBase::StartChanging, LBitmapBase::EndChanging, Class Members

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
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 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C++ Class Library Help