Displays the HTML Map Creator dialog, in order to create an HTML map upon an image. Use this dialog to create an HTML map area using the given bitmap.
#include "ltwrappr.h"
virtual L_INT LDialogWeb::DoModalHTMLMapper(hWndOwner)
Handle of the window which owns the dialog.
Value | Meaning |
---|---|
SUCCESS_DLG_OK | The "OK" button was pressed, and the dialog exited successfully. |
SUCCESS_DLG_CLOSE | The "Close" 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. |
LDialogWeb::SetHTMLMapperParams must be called before using this function to set the initial values for the dialog. You can get the updated HTMLMAPPERDLGPARAMS with the values entered by the user through the dialog by using LDialogWeb::GetHTMLMapperParams.
This dialog also offers tuning options for the output bitmap through the dialogs displayed using LDialogWeb::DoModalJPEGWebTuner, LDialogWeb::DoModalGIFWebTuner and LDialogWeb::DoModalPNGWebTuner.
// Example 1
L_INT LDialogWeb_DoModalHTMLMapperExample_1(LBitmap * pBitmap, HWND hWnd)
{
L_INT nRet = 0;
LDialogWeb DlgWeb;
HTMLMAPPERDLGPARAMS DlgParams;
DlgWeb.SetBitmap (pBitmap);
memset ( &DlgParams, 0, sizeof (HTMLMAPPERDLGPARAMS) ) ;
nRet = LDialogWeb::Initialize (0);
if(nRet != SUCCESS)
return nRet;
DlgParams.uStructSize = sizeof (HTMLMAPPERDLGPARAMS ) ;
nRet = DlgWeb.SetHTMLMapperParams(&DlgParams) ;
if(nRet != SUCCESS)
return nRet;
nRet = DlgWeb.DoModalHTMLMapper (hWnd);
if(nRet < 1)
return nRet;
// Gets the updated values for the structure
nRet = DlgWeb.GetHTMLMapperParams (&DlgParams, sizeof(DlgParams)) ;
if(nRet != SUCCESS)
return nRet;
nRet = LDialogWeb::Free ();
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}
// Example 2
L_VOID AllocHistoryEntries(LPDLGHISTORYLIST pHistoryEntries)
{
if ( NULL != pHistoryEntries )
{
pHistoryEntries->ppszEntry = (L_TCHAR**)malloc ( pHistoryEntries->nEntryCount * sizeof ( L_TCHAR* ) ) ;
if ( NULL != pHistoryEntries->ppszEntry )
{
int nIndex ;
for ( nIndex = 0; nIndex < pHistoryEntries->nEntryCount; nIndex++ )
{
pHistoryEntries->ppszEntry [ nIndex ] = NULL ;
}
for ( nIndex = 0; nIndex < pHistoryEntries->nEntryCount; nIndex++ )
{
pHistoryEntries->ppszEntry [ nIndex ] = (L_TCHAR*) malloc ( pHistoryEntries->nEntryLength * sizeof ( L_TCHAR ) ) ;
if ( NULL != pHistoryEntries->ppszEntry [ nIndex ] )
{
*pHistoryEntries->ppszEntry [ nIndex ] = 0 ;
}
}
}
}
}
L_VOID DeallocHistoryEntries (LPDLGHISTORYLIST pHistoryEntries )
{
// clean up
if ( NULL != pHistoryEntries->ppszEntry )
{
for ( int nIndex = 0; nIndex < pHistoryEntries->nEntryCount; nIndex++ )
{
if ( NULL != pHistoryEntries->ppszEntry [ nIndex ] )
{
free ( pHistoryEntries->ppszEntry [ nIndex ] ) ;
}
}
free ( pHistoryEntries->ppszEntry ) ;
}
}
L_INT LDialogWeb_DoModalHTMLMapperExample_2(LBitmap * pBitmap, HWND hWnd)
{
L_INT nRet = 0;
LDialogWeb DlgWeb;
HTMLMAPPERDLGPARAMS DlgParam;
DLGHISTORYLIST HistoryList ;
// init history buffer
HistoryList.uStructSize = sizeof ( DLGHISTORYLIST ) ;
HistoryList.nEntryCount = 5 ;
HistoryList.nValidEntryCount = 0 ;
HistoryList.nEntryLength = 15 ;
AllocHistoryEntries ( &HistoryList ) ;
// init dialog params
memset ( &DlgParam , 0, sizeof ( HTMLMAPPERDLGPARAMS ) ) ;
DlgParam.uStructSize = sizeof ( HTMLMAPPERDLGPARAMS ) ;
DlgParam.uDlgFlags = 0 ;
DlgParam.pURLEntries = &HistoryList ;
// show the dialog
nRet = LDialogWeb::Initialize (0);
if(nRet != SUCCESS)
return nRet;
DlgWeb.SetBitmap (pBitmap);
nRet = DlgWeb.SetHTMLMapperParams (&DlgParam) ;
if(nRet != SUCCESS)
return nRet;
nRet = DlgWeb.DoModalHTMLMapper(hWnd);
if(nRet < 1)
return nRet;
// Gets the updated values for the structure
nRet = DlgWeb.GetHTMLMapperParams (&DlgParam, sizeof(DlgParam)) ;
if(nRet != SUCCESS)
return nRet;
nRet = LDialogWeb::Free ();
if(nRet != SUCCESS)
return nRet;
// clean up
DeallocHistoryEntries ( &HistoryList ) ;
return SUCCESS;
}