How to monitor the progress of an index update in C++.
Remarks
To monitor the progress of an IndexJob in the C++ API:
(1) Derive a class from DIndexJob and
(2) Implement a virtual function, OnProgressUpdate(dtsIndexProgressInfo& info) to receive notifications.
Each time OnProgressUpdate is called, the dtsIndexProgressInfo.updateType will indicate the reason for the notification. The updateType is a MessageCode value that indicates when, for example, a file was successfully indexed (dtsnIndexFileDone) or could not be indexed due to an error (dtsnIndexFileOpenFail, dtsnIndexFileEncrypted). Example:
class MyIndexJob : public DIndexJob {
// The indexer will call OnProgressUpdate with many different types of notifications as the
// update proceeds.
virtual void OnProgressUpdate(dtsIndexProgressInfo& info) {
if (info.updateType == MessageCode.dtsnIndexFileDone)
cout << "Indexed: " << info.file.name << '\n';
else if (info.updateType == MessageCode.dtsnIndexFileOpenFail)
cout << "Not Indexed: " << info.file.name << " reason: " << info.file.openFailMessage << '\n';
else if (info.updateType == MessageCode.dtsnIndexFileEncrypted)
cout << "Encrypted: " << info.file.name << '\n';
// Call DIndexJob::Cancel() to stop the index update
if (userClickedCancelButton())
Cancel();
}
};
Group