Displays the File Association dialog, in order to change file association options.
#include "l_bitmap.h"
L_LTDLG_API L_INT L_DlgFilesAssociation(hWndOwner, pDlgParams)
Handle of the window that owns the dialog.
Pointer to a FILESASSOCIATIONDLGPARAMS used to initialize the 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 L_DlgOpen and L_DlgFilesAssociation because they have the same format.
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. |
Example 2:
L_INT DlgFilesAssociationExample(HWND hWnd,L_TCHAR* pszServerName)
{
L_INT 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 = pszServerName ;
DLGPARAMSFileAssociation.pszSelectedExt = pszSelectedFormats ;
DLGPARAMSFileAssociation.pHelpCallBackUserData = NULL ;
DLGPARAMSFileAssociation.pfnHelpCallback = NULL ;
nRet = L_DlgInit ( DLG_INIT_COLOR ) ;
if(nRet != SUCCESS && nRet != ERROR_DLG_ALREADYINITIATED)
return nRet;
nRet = L_DlgFilesAssociation ( hWnd, &DLGPARAMSFileAssociation ) ;
if(nRet < 1)
return nRet;
nRet = L_DlgFree () ;
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}