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.

Platforms

Win32, x64.

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

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 
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 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