LChange::ChangeToDIB

#include "ltwrappr.h"

static HGLOBAL LChange::ChangeToDIB(pLBitmap)

LBitmapBase L_FAR * pLBitmap;

/* pointer to a LEAD bitmap object */

Changes an LBitmapBase object's internal LEAD bitmap handle to a Windows Device Independent Bitmap (DIB). This function results in only one copy of the bitmap, and it invalidates the LEAD bitmap handle.

Parameter

Description

pLBitmap

Pointer to a LEAD bitmap object referencing the bitmap to change.

Returns

>0

Global memory handle to DIB.

0

An error occurred.

Comments

The orientation of the image and color order will depend on how the image was loaded into the LEAD bitmap.

When you no longer need the DIB, you can free it using the Windows GlobalFree() function.

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

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::ConvertFromDDB, LBitmapBase::ConvertFromDIB, LBitmapBase::ConvertToDDB, LBitmapBase::ConvertToDIB, LChange::ChangeFromDIB, Class Members

Topics:

Raster Image Functions: Creation, Deletion, and Copying

 

Using DIBs, DDBs, and the Clipboard

Example

L_VOID  TestFunction()
{
    LBitmapBase MyBitmap;
    HGLOBAL  hDib;

   MyBitmap.Load(TEXT("image1.cmp"));
   if(MyBitmap.IsAllocated())
   {
      hDib=LChange::ChangeToDIB(&MyBitmap);
      if(hDib!=0)
      {
         LBase::DisplayError(NULL,TEXT("Successful converting LEAD Bitmap to DIB Bitmap"));
         if(LChange::ChangeFromDIB(&MyBitmap, sizeof(BITMAPHANDLE), hDib)==SUCCESS)
            LBase::DisplayError(NULL,TEXT("Successful converting from DIB Bitmap to LEAD bitmap"));
      }
      else 
         LBase::DisplayErrorFromList(NULL);
   }
   else
      LBase::DisplayError(NULL,TEXT("Cannot Load Bitmap"));

   //…

}