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.

See Also

Elements:

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

Example

LBitmapBase MyBitmap;
BITMAPHANDLE SomeBitmapHandle;

L_InitBitmap(&SomeBitmapHandle, sizeof(SomeBitmapHandle),50, 50, 8);

MyBitmap.Load(TEXT("bitmap1.cmp"));
//1-free the bitmap
MyBitmap.SetHandle(0,TRUE);

MyBitmap.Load(TEXT("bitmap1.cmp"));
//2-Set another LEAD bitmap handle and free the previous one
MyBitmap.SetHandle(&SomeBitmapHandle,TRUE);

MyBitmap.Load(TEXT("bitmap1.cmp"));
//3-attach new bitmap without freeing the previous one
MyBitmap.SetHandle(&SomeBitmapHandle,FALSE);