LDialogWeb::DoModalJPEGWebTuner

#include "ltwrappr.h"

virtual L_INT LDialogWeb::DoModalJPEGWebTuner (hWndOwner)

HWND hWndOwner;

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

Displays the JPEG Web Tuner dialog box, and gets the tuning options used by LBitmapBase::Save.

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_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.

Comments

LDialogWeb::SetJPEGWebTunerParams must be called before using this function to set the initial values for the dialog. You can get the updated JPEGWEBTUNERDLGPARAMS with the values entered by the user through the dialog by using LDialogWeb::GetJPEGWebTunerParams.

The JPEG Web Tuner dialog.

Required DLLs and Libraries

LTDLGWEB
LTDLGKRN
LTDLGUTL
LTDLGCTRL
LTDLGCOM
LTFIL
LTDIS
LTIMG

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, LDialogFile::DoModalSave, LDialogWeb::DoModalGIFWebTuner, LDialogWeb::DoModalPNGWebTuner, LBase::EnableCallBack, LDialogBase::EnablePreview, LDialogBase::EnableAutoProcess, LDialogBase::EnableToolbar, LDialogBase::Free, LDialogWeb::GetJPEGWebTunerParams, LDialogWeb::SetJPEGWebTunerParams, Class Members

Topics:

Using Imaging Common Dialog

Example

// Example 1
L_INT LDialogWeb_DoModalJPEGWebTunerExample_1(LBitmap * pBitmap, HWND hWnd) 
{
   L_INT nRet = 0; 
   LDialogWeb DlgWeb; 
   JPEGWEBTUNERDLGPARAMS DlgParams; 
   DlgWeb.SetBitmap (pBitmap); 
   memset ( &DlgParams, 0, sizeof (JPEGWEBTUNERDLGPARAMS) ) ; 
   nRet = LDialogWeb::Initialize (0); 
   if(nRet != SUCCESS)
      return nRet;
   DlgParams.uStructSize      = sizeof (JPEGWEBTUNERDLGPARAMS) ; 
   DlgParams.uDlgFlags        = DLG_JPEGWEBTUNER_SHOW_EXPORT |
                                DLG_JPEGWEBTUNER_SHOW_INFORMATION | 
                                DLG_JPEGWEBTUNER_SHOW_SAVETHUMBNAIL |
                                DLG_JPEGWEBTUNER_SHOW_OPTIONS |
                                DLG_JPEGWEBTUNER_SHOW_SAVETHUMBNAIL ; 
   DlgWeb.EnablePreview (TRUE); 
   DlgWeb.EnableToolbar (TRUE); 
   DlgWeb.EnableCallBack (FALSE); 
   nRet = DlgWeb.SetJPEGWebTunerParams(&DlgParams) ; 
   if(nRet != SUCCESS)
      return nRet;
   nRet = DlgWeb.DoModalJPEGWebTuner(hWnd); 
   if(nRet < 1)
      return nRet;
   // Gets the updated values for the structure
   nRet = DlgWeb.GetJPEGWebTunerParams (&DlgParams, sizeof(DlgParams)) ; 
   if(nRet != SUCCESS)
      return nRet;
   nRet = LDialogWeb::Free ();
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}
// Example 2
L_INT ExportBitmap (L_TCHAR * szFileName, LBitmapBase *pLBitmap, LPJPEGWEBTUNERDLGPARAMS pParam ) 
{
   L_INT nRet;
   {// SAVE TO DISK
      SAVEFILEOPTION SaveOption ; 
      memset ( &SaveOption, 0, sizeof ( SAVEFILEOPTION ) ) ; 
      if ( pParam->bProgressive ) 
      {
         SaveOption.Passes = -1 ; 
      }
      if ( pParam->bWithStamp ) 
      {
         SaveOption.Flags       |=  ESO_JPEGSTAMP | ESO_SAVEWITHSTAMP ; 
         SaveOption.StampWidth  = 32 ; 
         SaveOption.StampHeight = 32 ; 
         SaveOption.StampBits   = 24 ; 
      }
       nRet = pLBitmap->Save (szFileName, 
                              pParam->nFormat, 
                              24, 
                              pParam->nQuality, 
                              0, 
                              &SaveOption ) ; 
       if(nRet != SUCCESS)
          return nRet;
   }// SAVE TO DISK
   return SUCCESS;
}
L_INT LDialogWeb_DoModalJPEGWebTunerExample_2(LBitmap * pBitmap, HWND hWnd) 
{
   L_INT nRet = 0; 
   LDialogWeb DlgWeb; 
   JPEGWEBTUNERDLGPARAMS DlgParams; 
   DlgWeb.SetBitmap (pBitmap); 
   memset ( &DlgParams, 0, sizeof (JPEGWEBTUNERDLGPARAMS) ) ; 
   nRet = LDialogWeb::Initialize (0); 
   if(nRet != SUCCESS)
      return nRet;
   DlgParams.uStructSize      = sizeof (JPEGWEBTUNERDLGPARAMS) ; 
   DlgParams.uDlgFlags        = DLG_JPEGWEBTUNER_SHOW_INFORMATION | 
                                DLG_JPEGWEBTUNER_SHOW_SAVETHUMBNAIL |
                                DLG_JPEGWEBTUNER_SHOW_OPTIONS ; 
   nRet = DlgWeb.SetJPEGWebTunerParams (&DlgParams) ; 
   if(nRet != SUCCESS)
      return nRet;
   nRet = DlgWeb.DoModalJPEGWebTuner(hWnd); 
   if(nRet < 1)
      return nRet;
   // Gets the updated values for the structure
   nRet = DlgWeb.GetJPEGWebTunerParams (&DlgParams, sizeof(DlgParams)) ; 
   if(nRet != SUCCESS)
      return nRet;
   if ( SUCCESS_DLG_OK == nRet ) 
   {
      nRet = ExportBitmap ( TEXT("tuned.jpg"), pBitmap, &DlgParams ) ; 
      if(nRet != SUCCESS)
         return nRet;
   }
   nRet = LDialogWeb::Free ();
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}