LDialogImageEffect::DoModalAddBitmaps

#include "ltwrappr.h"

virtual L_INT LDialogImageEffect::DoModalAddBitmaps(hWndOwner)

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

Parameters

HWND hWndOwner

Handle of the window which owns the dialog.

Returns

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

LDialogImageEffect::SetAddBitmapsParams must be called before using this function to set the initial values for the dialog. You can get the updated ADDBITMAPSDLGPARAMS with the values entered by the user through the dialog by using LDialogImageEffect::GetAddBitmapsParams.

The Add Bitmaps dialog.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT LDialogImageEffect_DoModalAddBitmapsExample(LBitmap * pBitmap, HWND hWnd) 
{ 
   L_INT nRet; 
 
   ADDBITMAPSDLGPARAMS DlgParams; 
   DLGBITMAPLISTITEM   BitmapListItems [ 3 ]; 
   DLGBITMAPLIST       BitmapList; 
   LBitmap  TmpBitmap1,TmpBitmap2,TmpBitmap3 ; 
   L_INT               i; 
 
   LDialogImageEffect DlgImageEffect; 
 
   DlgImageEffect.SetBitmap(pBitmap); 
 
   memset ( &DlgParams, 0, sizeof ( ADDBITMAPSDLGPARAMS ) ); 
 
   // ITEM (1) 
 
   BitmapListItems [ 0 ].pszDescription = ( L_TCHAR * ) malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ); 
 
   nRet = TmpBitmap1.Load (MAKE_IMAGE_PATH(TEXT("image1.cmp")),  
                  LOADFILE_ALLOCATE | LOADFILE_STORE | LOADFILE_COMPRESSED,  
                  ORDER_BGR,  
                  NULL,  
                  NULL ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   lstrcpy ( BitmapListItems [ 0 ].pszDescription, MAKE_IMAGE_PATH(TEXT("image1.cmp") )); 
 
   BitmapListItems [ 0 ].pBitmap = TmpBitmap1.GetHandle(); 
 
   // ITEM (2) 
 
   BitmapListItems [ 1 ].pszDescription = ( L_TCHAR * ) malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ); 
 
   lstrcpy ( BitmapListItems [ 1 ].pszDescription, MAKE_IMAGE_PATH(TEXT("image2.cmp"))); 
 
   nRet = TmpBitmap2.Load(MAKE_IMAGE_PATH(TEXT("image2.cmp")),  
                          LOADFILE_ALLOCATE | LOADFILE_STORE | LOADFILE_COMPRESSED,  
                          ORDER_BGR,  
                          NULL,  
                          NULL ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   BitmapListItems [ 1 ].pBitmap = TmpBitmap2.GetHandle (); 
 
   // ITEM (3) 
 
   BitmapListItems [ 2 ].pszDescription = ( L_TCHAR * ) malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ); 
 
   lstrcpy ( BitmapListItems [ 2 ].pszDescription, MAKE_IMAGE_PATH(TEXT("image2.cmp"))); 
 
   nRet = TmpBitmap3.Load (MAKE_IMAGE_PATH(TEXT("image2.cmp")),  
                           LOADFILE_ALLOCATE | LOADFILE_STORE | LOADFILE_COMPRESSED,  
                           ORDER_BGR,  
                           NULL,  
                           NULL ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   BitmapListItems [ 2 ].pBitmap = TmpBitmap3.GetHandle (); 
 
   BitmapList.nCount      = 3; 
 
   BitmapList.pBitmapList = ( LPDLGBITMAPLISTITEM ) &BitmapListItems;  
 
   DlgParams.uStructSize = sizeof(ADDBITMAPSDLGPARAMS); 
   DlgParams.pBitmapList      = &BitmapList; 
   DlgParams.uAddBitmapsFlags = BC_AVG; 
 
   nRet = LDialogBase::Initialize( 0 ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   DlgImageEffect.EnableCallBack(FALSE); 
   DlgImageEffect.EnablePreview(TRUE); 
   DlgImageEffect.EnableAutoProcess(TRUE); 
   DlgImageEffect.EnableToolbar(TRUE); 
 
   nRet = DlgImageEffect.SetAddBitmapsParams(&DlgParams); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = DlgImageEffect.DoModalAddBitmaps(hWnd); 
   if(nRet < 1) 
      return nRet; 
 
   //Gets the updated struct value. 
   nRet = DlgImageEffect.GetAddBitmapsParams(&DlgParams, sizeof(DlgParams)); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   nRet = LDialogBase::Free ( ); 
   if(nRet != SUCCESS) 
      return nRet; 
 
   // Clean up memory 
 
   for ( i = 0; i < 3; i++ ) 
   { 
      if ( NULL != BitmapListItems [ i ].pszDescription ) 
      { 
         free ( BitmapListItems [ i ].pszDescription ); 
      } 
   } 
 
   return SUCCESS; 
} 
Help Version 20.0.2019.11.25
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2019 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Common Dialog C++ Class Library Help