LDialogImageEffect::DoModalUnderlay

#include "ltwrappr.h"

virtual L_INT LDialogImageEffect::DoModalUnderlay(hWndOwner)

HWND hWndOwner;

/* handle of the window which owns the dialog */

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

Parameter

Description

hWndOwner

Handle of the window which owns the dialog.

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

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

The Underlay dialog.

Required DLLs and Libraries

LTDLGIMGEFX
LTDLGKRN
LTDLGUTL
LTDLGCTRL
LTDLGCOM
LTDIS
LTIMGUTL
LTIMGEFX

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:

LDialogBase::Initialize, LBitmapBase::Underlay , LBase::EnableCallBack , LDialogBase::EnablePreview, LDialogBase::EnableAutoProcess, LDialogBase::EnableToolbar, LDialogBase::Free, LDialogImageEffect::SetUnderlayParams, LDialogImageEffect::GetUnderlayParams

Topics:

Using Imaging Common Dialog

Example

#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName
L_INT LDialogImageEffect_DoModalUnderlayExample(LBitmap * pBitmap, HWND hWnd)
{
   L_INT nRet;
   LDialogImageEffect DlgImageEffect;
   nRet = LDialogImageEffect::Initialize(DLG_INIT_COLOR );
   if(nRet != SUCCESS)
      return nRet;
   DlgImageEffect.SetBitmap(pBitmap);
   UNDERLAYDLGPARAMS DlgParams; 
   DLGBITMAPLISTITEM Items [ 1 ];
   DLGBITMAPLIST     BitmapList;
   LBitmap TmpBitmap;
   memset ( &DlgParams, 0, sizeof ( UNDERLAYDLGPARAMS ) );
   DlgParams. uStructSize = sizeof ( UNDERLAYDLGPARAMS );
   Items [ 0 ].pszFileName  = ( L_TCHAR * ) malloc ( sizeof ( L_TCHAR ) * 20 );
   Items [ 0 ].pBitmap       = (pBITMAPHANDLE) malloc ( sizeof ( BITMAPHANDLE ) );
   lstrcpy ( Items [ 0 ].pszFileName, MAKE_IMAGE_PATH(TEXT("ULAY1.BMP") ) );
   nRet = TmpBitmap.LoadResize (Items [ 0 ].pszFileName,
                        100,
                        0,
                        24,
                        0,
                        ORDER_BGR,
                        NULL,
                        NULL );
   if(nRet != SUCCESS)
      return nRet;
   Items [ 0 ].pBitmap = TmpBitmap.GetHandle ();
   BitmapList.uStructSize  = sizeof ( DLGBITMAPLIST );
   BitmapList.pBitmapList = Items;
   BitmapList.nCount      = 1;
   DlgParams.uUnderlayFlags       = UB_TILE;
   DlgParams.nUnderlayBitmapIndex = 0;
   DlgParams.pBitmapList          = &BitmapList;
   DlgImageEffect.EnableCallBack (FALSE);
   DlgImageEffect.EnablePreview(TRUE);
   DlgImageEffect.EnableAutoProcess(TRUE);
   DlgImageEffect.EnableToolbar(TRUE);
   nRet = DlgImageEffect.SetUnderlayParams(&DlgParams);
   if(nRet != SUCCESS)
      return nRet;
   nRet = DlgImageEffect.DoModalUnderlay(hWnd); 
   if(nRet < 1)
      return nRet;
   // Gets the updated values for the structure
   nRet = DlgImageEffect.GetUnderlayParams(&DlgParams, sizeof(DlgParams));
   if(nRet != SUCCESS)
      return nRet;
   nRet = LDialogImageEffect::Free();
   if(nRet != SUCCESS)
      return nRet;
   nRet = TmpBitmap.Free();
   if(nRet != SUCCESS)
      return nRet;
   free ( Items [ 0 ].pszFileName );
   free ( Items [ 0 ].pBitmap );
   return SUCCESS;
}