LChange::ChangeFromDDB

#include "ltwrappr.h"

static L_INT LChange::ChangeFromDDB(hDC, uStructSize, pLBitmap, hBitmap, hPalette)

HDC hDC;

/* handle to the device responsible for the conversion */

L_UINT uStructSize;

/* size in bytes, of the structure pointed to by pLBitmap */

LBitmapBase * pLBitmap;

/* address of the LEAD bitmap object */

HBITMAP hBitmap;

/* handle to the DDB to be changed */

HPALETTE hPalette;

/* handle to the palette */

Changes a Windows device dependent bitmap (DDB) to a LEAD bitmap. The new LEAD bitmap is stored in the specified LBitmapBase object's internal LEAD bitmap handle. This function results in only one copy of the bitmap, and it invalidates the DDB handle.

Parameter

Description

hDC

Handle to the device responsible for the conversion. The mapping mode of the device context must be MM_TEXT.

uStructSize

Size in bytes, of the structure pointed to by pLBitmap. Use sizeof(BITMAPHANDLE).

pLBitmap

Address of the LEAD bitmap object.

hBitmap

Handle to the DDB to be changed.

hPalette

Handle to the palette. This value can be NULL if the hDC parameter refers to a device that is greater than 8 bits, or if the bitmap will use the system palette.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

After calling this function, the class object's internal LEAD bitmap handle will point to the previous DDB data.

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::ChangeToDDB, Class Members

Topics:

Raster Image Functions: Creation, Deletion, and Copying

 

Using DIBs, DDBs, and the Clipboard

Example

L_INT LChange__ChangeFromDDBExample(HINSTANCE hAppInstance)
{
   L_INT nRet;
   LBitmapBase MyBitmap;
   HBITMAP   hBitmap;
   HDC hDC;
   hBitmap=LoadBitmap(hAppInstance,TEXT("ResourceBitmap"));
   if(hBitmap)
   {
      hDC=GetDC(NULL);
      nRet = LChange::ChangeFromDDB(hDC,&MyBitmap, sizeof(BITMAPHANDLE),hBitmap,NULL);
      if(nRet != SUCCESS)
         return nRet;
      if(MyBitmap.IsAllocated())
      {
         LBase::DisplayError(NULL,TEXT("Successful converting DDB Bitmap to LEAD Bitmap"));
         hBitmap=LChange::ChangeToDDB(hDC,&MyBitmap);
         if(hBitmap)
            LBase::DisplayError(NULL,TEXT("Successful converting from LEAD Bitmap to DDB Bitmap"));
      }
      else 
         LBase::DisplayErrorFromList(NULL);
      ReleaseDC(NULL,hDC);
   }
   else
      LBase::DisplayError(NULL,TEXT("Cannot Load Bitmap from resource"));
   return SUCCESS;
}