reference:plugins:plugin_sdk:batch_mode_functions:showfunctionreplacedlg

ShowFunctionReplaceDlg(
     LPVOID:lpFuncData,
     LPTSTR:lpszSourceFile,
     LPWIN32_FIND_DATA:pwfdSource,
     LPTSTR:lpszDestFile,
     LPWIN32_FIND_DATA:pwfdDest,
     LPTSTR:lpszNewName,
     int:cchNewNameMax,
     DWORD:dwFlags
)
→ int

Arguments

lpFuncData

[in] The value of the lpFuncData member of the VFSBATCHDATA structure

lpszSourceFile

[in] The full path name of the source (new) file.

pwfdSource

[in] Pointer to a WIN32_FIND_DATA structure that describes the source file.

lpszDestFile

[in] The full path name of the destination (existing) file.

pwfdDest

[in] Pointer to a WIN32_FIND_DATA structure that describes the destination file.

lpszNewName

[in] If you wish to allow the user to specify a new output filename, this is a pointer to a buffer where the new filename will be stored. Set to NULL to disable the rename option.

cchNewNameMax

[in] Size of the lpszNewName buffer in characters. Ignored if lpszNewName is NULL.

dwFlags

[in] Flags that control the replace dialog. Valid flags are:

REPLACEDLGF_RESUMEGive the option of resuming the copy
REPLACEDLGF_NODESTINFONo information available for destination file
REPLACEDLGF_READONLYSpecial prompting for read-only files
REPLACEDLGF_NOTHUMBSDon't display thumbnails in overwrite dialog
REPLACEDLGF_NOIDENTICALDon't give option to skip identical files

Return value

The return value depends upon the choice made by the user. Valid return values are:

REPLACERES_ABORTCopy operation should be aborted
REPLACERES_REPLACEExisting file should be replaced
REPLACERES_REPLACEALLThis and all subsequent files should be replaced
REPLACERES_SKIPSkip this file, continue with next file
REPLACERES_SKIPALLSkip this and all subsequent existing files
REPLACERES_SKIPIDENTICALSkip all identical files
REPLACERES_RESUMEResume copy into destination file
REPLACERES_RESUMEALLResume this and all subsequent files
REPLACERES_RENAMENew name specified for destination file

Description

The ShowFunctionReplaceDlg function lets you more fully emulate Opus when performing a batch copy operation. It displays the dialog that allows a user to confirm that they wish to overwrite an existing file.

When performing a batch copy operation, you should test if the BATCHF_COPY_ASK_REPLACE flag is set, and if so, check if the destination file already exists. If it does, you should call this function to ask the user for permission to overwrite the file.

If BATCHF_COPY_ASK_REPLACE_RO is set and the existing file has the read-only attribute set, you should call this function with the REPLACEDLGF_READONLY flag set.

If a buffer is provided for lpszNewName then the user will be given the option of providing a new name for the destination file. If the return code is REPLACERES_RENAME you should check if the new filename specified by the user also exists, and if so, call this function again for further confirmation.

If you are able to resume file copies (eg, FTP), you should set the REPLACEDLGF_RESUME flag. If the user elects to resume the copy you should seek to the end of the existing destination file, and to the same relative position in the source file, and continue the copy in append mode.

If the return code is REPLACERES_REPLACEALL, REPLACERES_SKIPALL or REPLACERES_RESUMEALL, you should save this and not prompt the user again for any further existing files (instead, you should replace, skip or resume them as appropriate.)