TaskDone Method  
 

Determine if an asynchronous task has completed.

Syntax

object.TaskDone ( [TaskId] )

Parameters

TaskId
An optional integer value that specifies the unique identifier associated with a background task.

Return Value

A Boolean value that specifies if the task has completed. A return value of True specifies that the background task has completed. A return value of False specifies that the background task is active.

Remarks

The TaskDone method is used to determine if the specified asynchronous task has completed. If the TaskId parameter is omitted, the method will check the status of the last background task that was started.

If you use this method to poll the status of a background task from within the main UI thread, you must ensure that Windows messages are processed so that the application remains responsive to the end-user. To check if a background transfer has completed, it is recommended that you use a timer to periodically call this method rather than calling it repeatedly within a loop.

To determine if the task completed successfully, the TaskWait method will provide the last error code associated with the task. Note that if this method returns True, it is guaranteed that calling TaskWait using the same task ID will return the error code to the caller immediately without causing the application to block.

See Also

TaskCount Property, TaskId Property, TaskList Property, TaskAbort Method, TaskWait Method