Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
#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
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
Functions: |
|
Topics: |
|
|
Example
#define MAKE_IMAGE_PATH(pFileName) TEXT("C:\\Users\\Public\\Documents\\LEADTOOLS Images\\")pFileName 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 ].pszDescription = ( L_TCHAR* ) malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; BitmapListItems [ 0 ].pBitmap = ( pBITMAPHANDLE ) malloc ( sizeof ( BITMAPHANDLE ) ) ; lstrcpy ( BitmapListItems [ 0 ].pszDescription,MAKE_IMAGE_PATH(TEXT("IMAGE1.CMP")) ) ; nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("IMAGE1.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 ].pszDescription = ( L_TCHAR* ) malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; BitmapListItems [ 1 ].pBitmap = ( pBITMAPHANDLE ) malloc ( sizeof ( BITMAPHANDLE ) ) ; lstrcpy ( BitmapListItems [ 1 ].pszDescription,MAKE_IMAGE_PATH(TEXT("IMAGE2.CMP"))) ; nRet = L_LoadBitmap (MAKE_IMAGE_PATH(TEXT("IMAGE2.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 ].pszDescription = ( L_TCHAR* ) malloc ( sizeof ( L_TCHAR ) * L_MAXPATH ) ; BitmapListItems [ 2 ].pBitmap = ( pBITMAPHANDLE ) malloc ( sizeof ( BITMAPHANDLE ) ) ; lstrcpy ( BitmapListItems [ 2 ].pszDescription,MAKE_IMAGE_PATH(TEXT("IMAGE2.CMP"))) ; nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("IMAGE2.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 ].pszDescription ) { free ( BitmapListItems [ i ].pszDescription ) ; } } return SUCCESS; }