LDialogImageEffect::DoModalAddBitmaps
#include "ltwrappr.h"
virtual L_INT LDialogImageEffect::DoModalAddBitmaps(hWndOwner)
HWND hWndOwner; |
/* handle of the window which owns the dialog */ |
Displays the Add Bitmaps dialog box, and gets the options for LBitmapBase::Add.
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::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 is shown in the following figure:
Required DLLs and Libraries
LTDLGIMGEFX 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
Example
void TestFunction(LBitmap * pBitmap, HWND hWnd)
{
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 ].pszFileName = ( L_TCHAR L_FAR * ) malloc ( sizeof ( L_TCHAR ) * 20 );
BitmapListItems [ 0 ].pBitmap = ( pBITMAPHANDLE ) malloc ( sizeof ( BITMAPHANDLE ) );
TmpBitmap1.Load(TEXT("C:\\sample1.cmp"),
LOADFILE_ALLOCATE | LOADFILE_STORE | LOADFILE_COMPRESSED,
ORDER_BGR,
NULL,
NULL );
lstrcpy ( BitmapListItems [ 0 ].pszFileName, TEXT("C:\\sample1.cmp") );
BitmapListItems [ 0 ].pBitmap = TmpBitmap1. GetHandle();
// ITEM (2)
BitmapListItems [ 1 ].pszFileName = ( L_TCHAR L_FAR * ) malloc ( sizeof ( L_TCHAR ) * 20 );
BitmapListItems [ 1 ].pBitmap = ( pBITMAPHANDLE ) malloc ( sizeof ( BITMAPHANDLE ) );
lstrcpy ( BitmapListItems [ 1 ].pszFileName, TEXT("C:\\sample2.cmp"));
TmpBitmap2.Load(TEXT("C:\\sample2.cmp"),
LOADFILE_ALLOCATE | LOADFILE_STORE | LOADFILE_COMPRESSED,
ORDER_BGR,
NULL,
NULL );
BitmapListItems [ 1 ].pBitmap = TmpBitmap2. GetHandle();
// ITEM (3)
BitmapListItems [ 2 ].pszFileName = ( L_TCHAR L_FAR * ) malloc ( sizeof ( L_TCHAR ) * 20 );
BitmapListItems [ 2 ].pBitmap = ( pBITMAPHANDLE ) malloc ( sizeof ( BITMAPHANDLE ) );
lstrcpy ( BitmapListItems [ 2 ].pszFileName, TEXT("C:\\sample3.cmp"));
TmpBitmap3.Load(TEXT("C:\\sample3.cmp"),
LOADFILE_ALLOCATE | LOADFILE_STORE | LOADFILE_COMPRESSED,
ORDER_BGR,
NULL,
NULL );
BitmapListItems [ 2 ].pBitmap = TmpBitmap3. GetHandle();
BitmapList.nCount = 3;
BitmapList.pBitmapList = ( LPDLGBITMAPLISTITEM ) &BitmapListItems;
DlgParams.pBitmapList = &BitmapList;
DlgParams.uAddBitmapsFlags = BC_AVG;
LDialogBase::Initialize( 0 );
DlgImageEffect.EnableCallBack(FALSE);
DlgImageEffect.EnablePreview(TRUE);
DlgImageEffect.EnableAutoProcess(TRUE);
DlgImageEffect.EnableToolbar(TRUE);
DlgImageEffect.SetAddBitmapsParams(&DlgParams);
DlgImageEffect.DoModalAddBitmaps(hWnd);
//Gets the updated struct value.
DlgImageEffect.GetAddBitmapsParams(&DlgParams, sizeof(DlgParams));
LDialogBase::Free ( );
// 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 );
}
}
}