LDialogFile::DoModalFilesAssociation

#include "ltwrappr.h"

virtual L_INT LDialogFile::DoModalFilesAssociation (hWndOwner)

HWND hWndOwner;

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

Displays the File Association dialog, in order to change file association options.

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

LDialogFile::SetFilesAssociationParams must be called before using this function to set the initial values for the dialog. You can get the updated FILESASSOCIATIONDLGPARAMS with the values entered by the user through the dialog by using LDialogFile::GetFilesAssociationParams.

The File Association dialog.

Use this dialog to control how the shell treats certain types of files. This lets you link your application to a certain file type, which causes the application to take ownership of that file type.

The parameters are used as input only and will not be updated by the dialog.

If the function was successful, then file formats will be associated or de-associated accordingly.

The same filter group string can be passed for both LDialogFile::DoModalOpen and LDialogFile::DoModalFilesAssociation because they have the same format.

Required DLLs and Libraries

LTDLGFILE
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:

Class Members, LDialogFile::GetFilesAssociationParams, LDialogFile::SetFilesAssociationParams, LBase::EnableCallBack, LDialogBase::EnablePreview, LDialogBase::EnableAutoProcess, LDialogBase::EnableToolbar, LDialogBase::Free, LDialogBase::Initialize, LBitmapBase::Load

Topics:

Using Imaging Common Dialog

 

NAPLPS Format (NAP)

Example

L_INT LDialogFile_DoModalFilesAssociationExample_1(LBitmap * pBitmap, HWND hWnd, L_TCHAR* pszServerAppName ) 
{
   L_INT nRet = 0; 
   LDialogFile DlgFile; 
   DlgFile.SetBitmap (pBitmap); 
   nRet = LDialogFile::Initialize (0); 
   if(nRet != SUCCESS)
      return nRet;
   FILESASSOCIATIONDLGPARAMS DLGPARAMSFileAssociation ; 
   memset ( &DLGPARAMSFileAssociation, 0, sizeof ( FILESASSOCIATIONDLGPARAMS ) ) ; 
   DLGPARAMSFileAssociation.uStructSize           = sizeof ( FILESASSOCIATIONDLGPARAMS ) ; 
   DLGPARAMSFileAssociation.pszFormats             = NULL ; 
   DLGPARAMSFileAssociation.pszServerAppName      = pszServerAppName; 
   DLGPARAMSFileAssociation.pszSelectedExt         = NULL ; 
   DLGPARAMSFileAssociation.pHelpCallBackUserData = NULL ; 
   DLGPARAMSFileAssociation.pfnHelpCallback       = NULL ; 
   DlgFile.EnableCallBack (FALSE); 
   nRet = DlgFile.SetFilesAssociationParams (&DLGPARAMSFileAssociation) ; 
   if(nRet != SUCCESS)
      return nRet;
   nRet = DlgFile.DoModalFilesAssociation(hWnd); 
   if(nRet < 1)
      return nRet;
   // Gets the updated values for the structure
   nRet = DlgFile.GetFilesAssociationParams(&DLGPARAMSFileAssociation, sizeof(DLGPARAMSFileAssociation)) ; 
   if(nRet != SUCCESS)
      return nRet;
   nRet = LDialogFile::Free ();
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}
L_INT LDialogFile_DoModalFilesAssociationExample_2(LBitmap * pBitmap, HWND hWnd, L_TCHAR* pszServerAppName ) 
{
   L_INT nRet = 0; 
   LDialogFile DlgFile; 
   DlgFile.SetBitmap (pBitmap); 
   nRet = LDialogFile::Initialize (0); 
   if(nRet != SUCCESS)
      return nRet;
   FILESASSOCIATIONDLGPARAMS DLGPARAMSFileAssociation ; 
   L_TCHAR* pszFormats = 
   {
      TEXT("LEAD (*.cmp)\0")           TEXT("*.cmp\0")
      TEXT("DICOM (*.dic)\0")          TEXT("*.dic\0")
      TEXT("Windows Bitmap (*.bmp)\0") TEXT("*.bmp\0")
      TEXT("\0")
   } ; 
   L_TCHAR* pszSelectedFormats = 
   { 
      TEXT(".cmp\0")
      TEXT(".dic\0")
      TEXT("\0")
   } ; 
   memset ( &DLGPARAMSFileAssociation, 0, sizeof ( FILESASSOCIATIONDLGPARAMS ) ) ; 
   DLGPARAMSFileAssociation.uStructSize           = sizeof ( FILESASSOCIATIONDLGPARAMS ) ; 
   DLGPARAMSFileAssociation.pszFormats             = pszFormats ; 
   DLGPARAMSFileAssociation.pszServerAppName      = pszServerAppName ; 
   DLGPARAMSFileAssociation.pszSelectedExt         = pszSelectedFormats ; 
   DLGPARAMSFileAssociation.pHelpCallBackUserData = NULL ; 
   DLGPARAMSFileAssociation.pfnHelpCallback       = NULL ; 
   DlgFile.EnableCallBack (FALSE); 
   nRet = DlgFile.SetFilesAssociationParams (&DLGPARAMSFileAssociation) ; 
   if(nRet != SUCCESS)
      return nRet;
   nRet = DlgFile.DoModalFilesAssociation(hWnd); 
   if(nRet < 1)
      return nRet;
   // Gets the updated values for the structure
   nRet = DlgFile.GetFilesAssociationParams(&DLGPARAMSFileAssociation, sizeof(DLGPARAMSFileAssociation)) ; 
   if(nRet != SUCCESS)
      return nRet;
   nRet = LDialogFile::Free ();
   if(nRet != SUCCESS)
      return nRet;
   return SUCCESS;
}