L_DlgFilesAssociation

#include "l_bitmap.h"

L_INT EXT_FUNCTION L_DlgFilesAssociation(hWndOwner, pDlgParams)

HWND hWndOwner;

/*owner of the dialog*/

LPFILESASSOCIATIONDLGPARAMS pDlgParams;

/*pointer to a structure*/

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

Parameter

Description

hWndOwner

Handle of the window that owns the dialog.

pDlgParams

Pointer to a FILESASSOCIATIONDLGPARAMS used to initialize the dialog.

Comments

The File Association dialog can be seen below:

image\FileAssociation.gif

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 L_DlgOpen and L_DlgFilesAssociation because they have the same format.

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.

Required DLLs and Libraries

LTDLGFILE
LTDLGKRN
LTDLGUTL
LTDLGCTRL
LTDLGCOM
LTFIL
LTDIS
LTIMG
LTKRN

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:

L_DlgInit, L_DlgOpen

Topics:

Dialogs: Maintenance and General Use

 

Using Imaging Common Dialog

Example

Example 1:

L_VOID ShowAssociationDlg ( HWND hWnd, L_TCHAR* pszServerName )
{
   FILESASSOCIATIONDLGPARAMS DLGPARAMSFileAssociation ;

   memset ( &DLGPARAMSFileAssociation, 0, sizeof ( FILESASSOCIATIONDLGPARAMS ) ) ;

   DLGPARAMSFileAssociation.uStructSize           = sizeof ( FILESASSOCIATIONDLGPARAMS ) ;
   DLGPARAMSFileAssociation.pszFormats             = NULL ;
   DLGPARAMSFileAssociation.pszServerAppName         = pszServerName ;
   DLGPARAMSFileAssociation.pszSelectedExt         = NULL ;
   DLGPARAMSFileAssociation.pHelpCallBackUserData = NULL ;
   DLGPARAMSFileAssociation.pfnHelpCallback       = NULL ;

   L_DlgInit ( DLG_INIT_COLOR ) ;

   L_DlgFilesAssociation ( hWnd, &DLGPARAMSFileAssociation ) ;
   
   L_DlgFree ( ) ;

}

Example 2:

L_VOID ShowAssociationDlg ( HWND hWnd, L_TCHAR* pszServerName )
{
   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         = pszServerName ;
   DLGPARAMSFileAssociation.pszSelectedExt         = pszSelectedFormats ;
   DLGPARAMSFileAssociation.pHelpCallBackUserData = NULL ;
   DLGPARAMSFileAssociation.pfnHelpCallback       = NULL ;

   L_DlgInit ( DLG_INIT_COLOR ) ;

   L_DlgFilesAssociation ( hWnd, &DLGPARAMSFileAssociation ) ;

   L_DlgFree ( ) ;
}