LChange::ChangeFromDDB

#include "ltwrappr.h"

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

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.

Parameters

HDC hDC

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

L_UINT uStructSize

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

LBitmapBase * pLBitmap

Address of the LEAD bitmap object.

HBITMAP hBitmap

Handle to the DDB to be changed.

HPALETTE 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

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

Platforms

Win32, x64.

See Also

Functions

Topics

Example

L_INT LChange__ChangeFromDDBExample() 
{ 
   L_INT nRet; 
   LBitmapBase Bitmap; 
   HBITMAP   hBitmap; 
   HDC hDC; 
 
   hDC=GetDC(NULL); 
 
   nRet = Bitmap.Load(MAKE_IMAGE_PATH(TEXT("image1.cmp"))); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   hBitmap=LChange::ChangeToDDB(hDC,&Bitmap); 
   if(hBitmap) 
      LBase::DisplayError(NULL,TEXT("Successful converting from LEAD Bitmap to DDB Bitmap")); 
 
   nRet = Bitmap.Free(); 
 
   if(hBitmap) 
   { 
      nRet = LChange::ChangeFromDDB(hDC,&Bitmap, sizeof(BITMAPHANDLE),hBitmap,NULL); 
      if(nRet != SUCCESS) 
         return nRet; 
      if(Bitmap.IsAllocated()) 
      { 
         LBase::DisplayError(NULL,TEXT("Successful converting DDB Bitmap to LEAD Bitmap")); 
      } 
      else  
         LBase::DisplayErrorFromList(NULL); 
 
      ReleaseDC(NULL,hDC); 
   } 
   else 
      LBase::DisplayError(NULL,TEXT("Cannot Load Bitmap from resource")); 
 
   return SUCCESS; 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help