LDialogFile::DoModalFilesAssociation

Summary

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

Syntax

#include "ltwrappr.h"

virtual L_INT LDialogFile::DoModalFilesAssociation (hWndOwner)

Parameters

HWND hWndOwner

Handle of the window which owns the dialog.

Returns

Value Meaning
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

See Also

Functions

Topics

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; 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Common Dialog C++ Class Library Help

Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.