reference:plugins:plugin_sdk:batch_mode_functions:updatefunctionprogressbar

UpdateFunctionProgressBar(
     LPVOID:lpFuncData,
     UINT:uiAction,
     DWORD_PTR:dwData
)
→ void

Arguments

lpFuncData

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

uiAction

[in] The action to perform. Valid actions are:

PROGRESSACTION_STATUSTEXTUpdate progress dialog text
PROGRESSACTION_NEXTFILEMove to the next file
PROGRESSACTION_SETFILENAMESet the current filename
PROGRESSACTION_SETFILESIZESet the current file size
PROGRESSACTION_SETFILESIZE64Set the current file size (64-bit)
PROGRESSACTION_STEPBYTESStep the progress bar a number of bytes
PROGRESSACTION_SETBYTESSet current byte progress
PROGRESSACTION_SETBYTES64Set current byte progress (64-bit)
PROGRESSACTION_SKIPFILESkip the current file
PROGRESSACTION_PERCENTMODEPercentage rather than byte progress
PROGRESSACTION_SETPERCENTSet current percent progress
PROGRESSACTION_NOPROGRESSNo progress bars

dwData

[in] The dwData value depends upon the value of uiAction. See Remarks section for more details.

Return value

None.

Description

The UpdateFunctionProgressBar function is used to update the progress display when performing a batch operation.

The progress display for a batch operation is automatically created and displayed by Opus. Opus is also responsible for counting the total number of files and folders involved in the operation, and so the progress bars are pre-set to the correct levels. It is your responsibility to update the progress display as you perform the batch operation.

For both copy and delete operations this involves setting the status bar text as appropriate, and notifying the progress display for each file. For copy operations you should also notify the progress display of the size of each file, and send regular 'step' messages as the file copy progresses, to ensure the user is kept informed of the progress of the operation.

The value of the dwData parameter depends on the value of uiAction:

  • PROGRESSACTION_STATUSTEXT
    This message causes the specified text to be displayed in the top line of the status bar. For example, if you have a lengthy initialization process, you should display appropriate text to let the user know what is happening. This action has both ANSI and Unicode variants.
  • PROGRESSACTION_NEXTFILE
    Send this message to step the progress bar to the next file. You can optionally specify the name of the next file as the dwData parameter (this action has both ANSI and Unicode variants if you wish to supply the filename)
  • PROGRESSACTION_SETFILENAME
    This is used to set the name of the current file without stepping the progress bar. If the BATCHF_PROGRESS_SUBFOLDERS flag is set in the VFSBATCHDATA structure, it indicates that Opus has performed counting of files in sub-folders, and therefore has included sub-folder file counts in the overall progress display.

    Therefore, if BATCHF_PROGRESS_SUBFOLDERS is set, you should use PROGRESSACTION_NEXTFILE for all files inside sub-folders.

    However, if the BATCHF_PROGRESS_SUBFOLDERS flag is not set, you should only use PROGRESSACTION_NEXTFILE for top-level files and folders, and should use PROGRESSACTION_SETFILENAME to simply update the filename display when operating on files in sub-folders.

    This action has both ANSI and Unicode variants.
  • PROGRESSACTION_SETFILESIZE / PROGRESSACTION_SETFILESIZE64
    These messages are used to set the size of the current file. Note that while PROGRESSACTION_SETFILESIZE takes a 32-bit DWORD as a parameter, PROGRESSACTION_SETFILESIZE64 takes a pointer to an unsigned 64-bit value.
  • PROGRESSACTION_STEPBYTES
    Use this message to step the progress bar a specified number of bytes. You should call this at regular intervals while copying files to keep the progress display updated. This takes a 32-bit DWORD as a parameter.
  • PROGRESSACTION_SETBYTES / PROGRESSACTION_SETBYTES64
    This message is used to set the current byte position in the current file (eg, you could use this to jump to a given offset when resuming a file copy.) PROGRESSACTION_SETBYTES takes a 32-bit DWORD as a parameter, while PROGRESSACTION_SETBYTES64 takes a pointer to an unsigned 64-bit value.
  • PROGRESSACTION_SKIPFILE
    This message should be sent when skipping over a file (for example, because an error occurred or the user opted not to overwrite an existing file.) It causes the progress bar to automatically account for any remaining data in the current file. You should not send this message if a copy completes successfully. dwData is ignored.
  • PROGRESSACTION_PERCENTMODE
    This message should be sent before any others if you wish to place the progress display in percent mode. In this mode, it does not track individual or total byte counts, but instead displays a percentage of overall completeness. dwData is ignored.
  • PROGRESSACTION_SETPERCENT
    This message is used in percent mode to set the current percent complete. dwData must be a value from 0 to 100.
  • PROGRESSACTION_NOPROGRESS
    This message should be sent before any others if you wish to hide the progress bars from the progress display. The progress dialog will instead display an animation, a single line of text and optionally an abort button. dwData must be set using the following flags:
NOPROGRESSF_BATCHCOPYCopy operation (displays copy animation)
NOPROGRESSF_BATCHDELETEDelete operation (displays delete animation)
NOPROGRESSF_NOABORTDoes not display the abort button