L_DlgAddBitmaps

#include "l_bitmap.h"

L_LTDLG_API L_INT L_DlgAddBitmaps (hWndOwner, pDlgParams)

L_HWND hWndOwner;

/* owner of dialog */

LPADDBITMAPSDLGPARAMS pDlgParams;

/* pointer to a structure */

Displays the Add Bitmaps dialog box, and gets the options for L_AddBitmaps.

Parameter

Description

hWndOwner

Handle of the window which owns the dialog.

pDlgParams

Pointer to a ADDBITMAPSDLGPARAMS structure to be updated with the values entered by the user, through the dialog. Set members of this structure, before calling this function, to set the dialogs initial values.

Returns

SUCCESS_DLG_OK

The "OK" button was pressed, and the dialog exited successfully.

SUCCESS_DLG_CANCEL

The "Cancel" button was pressed, and the dialog exited successfully.

< 1

An error occurred. Refer to Return Codes.

Comments

The Add Bitmaps dialog.

Required DLLs and Libraries

LTDLGIMGEFX
LTDLGKRN
LTDLGUTL
LTDLGCTRL
LTDLGCOM
LTDIS
LTIMGUTL
LTIMGCLR
LTKRN

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:

L_DlgInit, L_AddBitmaps

Topics:

Dialogs: Artistic Effects

 

Using Imaging Common Dialog

Example

 L_INT DLGAddBitmapsExample(HWND hWnd,pBITMAPHANDLE   pResultedBitmap)
{
   L_INT nRet;
   ADDBITMAPSDLGPARAMS DlgParams ;
   DLGBITMAPLISTITEM   BitmapListItems [ 3 ] ;
   DLGBITMAPLIST       BitmapList ;
   L_INT               i ; 

   memset ( &DlgParams, 0, sizeof ( ADDBITMAPSDLGPARAMS ) ) ; 
   memset ( &BitmapListItems, 0, sizeof ( DLGBITMAPLISTITEM ) * 3 ) ; 
   memset ( &BitmapList, 0, sizeof ( DLGBITMAPLIST ) ) ; 

   // ITEM (1) 
   BitmapListItems [ 0 ].pszFileName = ( L_TCHAR* ) malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ;
   BitmapListItems [ 0 ].pBitmap     = ( pBITMAPHANDLE ) malloc ( sizeof ( BITMAPHANDLE ) ) ;

   lstrcpy ( BitmapListItems [ 0 ].pszFileName, TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\sample1.cmp") ) ;
   nRet = L_LoadBitmap(TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\sample1.cmp"),
                BitmapListItems [ 0 ].pBitmap,
                sizeof ( BITMAPHANDLE ),
                LOADFILE_ALLOCATE | LOADFILE_STORE | LOADFILE_COMPRESSED,
                ORDER_BGR,
                NULL,
                NULL ) ;
   if(nRet != SUCCESS)
      return nRet;

   // ITEM (2) 
   BitmapListItems [ 1 ].pszFileName = ( L_TCHAR* ) malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; 
   BitmapListItems [ 1 ].pBitmap     = ( pBITMAPHANDLE ) malloc ( sizeof ( BITMAPHANDLE ) ) ; 

   lstrcpy ( BitmapListItems [ 1 ].pszFileName, TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\sample2.cmp") ) ;
   nRet = L_LoadBitmap (TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\sample2.cmp"),
                 BitmapListItems [ 1 ].pBitmap,
                 sizeof ( BITMAPHANDLE ),
                 LOADFILE_ALLOCATE | LOADFILE_STORE | LOADFILE_COMPRESSED,
                 ORDER_BGR,
                 NULL,
                 NULL ) ;
   if(nRet != SUCCESS)
      return nRet;

   // ITEM (3) 
   BitmapListItems [ 2 ].pszFileName = ( L_TCHAR* ) malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ;
   BitmapListItems [ 2 ].pBitmap     = ( pBITMAPHANDLE ) malloc ( sizeof ( BITMAPHANDLE ) ) ;

   lstrcpy ( BitmapListItems [ 2 ].pszFileName, TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\sample3.cmp") ) ;
   nRet = L_LoadBitmap(TEXT("C:\\Program Files\\LEAD Technologies\\LEADTOOLS 16\\Images\\sample3.cmp"),
                BitmapListItems [ 2 ].pBitmap,
                sizeof ( BITMAPHANDLE ),
                LOADFILE_ALLOCATE | LOADFILE_STORE | LOADFILE_COMPRESSED,
                ORDER_BGR,
                NULL,
                NULL ) ;
   if(nRet != SUCCESS)
      return nRet;

   BitmapList.nCount      = 3 ;
   BitmapList.pBitmapList = ( LPDLGBITMAPLISTITEM ) &BitmapListItems ;

   DlgParams.uStructSize      = sizeof(ADDBITMAPSDLGPARAMS);
   DlgParams.pBitmap          = pResultedBitmap ;
   DlgParams.pBitmapList      = &BitmapList ;
   DlgParams.uAddBitmapsFlags = BC_AVG ;
   DlgParams.uDlgFlags        = DLG_ADDBITMAPS_AUTOPROCESS        |
                                DLG_ADDBITMAPS_SHOW_PREVIEW       |
                                DLG_ADDBITMAPS_SHOW_TOOL_ZOOMLEVEL;
      
   nRet = L_DlgInit ( DLG_INIT_COLOR ) ;
   if(nRet != SUCCESS && nRet != ERROR_DLG_ALREADYINITIATED)
      return nRet;
   nRet = L_DlgAddBitmaps ( hWnd, &DlgParams ) ;
   if(nRet < 1)
      return nRet;
   nRet = L_DlgFree () ;
   if(nRet != SUCCESS)
      return nRet;

   // Clean up memory
   for ( i = 0; i < 3; i++ ) 
   {
      if ( NULL != BitmapListItems [ i ].pBitmap )
      {
         free ( BitmapListItems [ i ].pBitmap ) ;
      }
      
      if ( NULL != BitmapListItems [ i ].pszFileName )
      {
         free ( BitmapListItems [ i ].pszFileName ) ;
      }
   }
   return SUCCESS;
}