0

I am programming to my friend with Qt Creator in C++. My question: 1.- How can I get the copy percentage of each drive is object of file copying, while the copying is make in other application, such as Windows Explorer, or TeraCopy...? (In Windows 64 bits).

The big problem is my friend have many drives because he works to many clients and they give him many USB pendrives to copy information. I try to find on internet the answer for some context to understand the philosophy and imagine the way to code , but I don't find it.

Some code for this:

void Widget::print_copy_percentage(QString drive){
    int current_copy_percentage;
    //  .... the answer current_copy_percentage = ...  ;

    //find the drive
    int i;
    for (i=0; i < TOTAL; ++i)
       if (drives.at(i) == drive)
          break;

     //publish the information
    ProgressBar[i]->setValue(current_copy_percentage);
    ProgressBar[i]->show();
}
eyllanesc
  • 235,170
  • 19
  • 170
  • 241
  • 1
    Calculating a percentage of the task completed requires knowledge of the actual task. Outside of the application performing the copy, you cannot know this unless that application provides the information via interprocess communication, log files, some API, or otherwise. Your best option would probably be to use something like Robocopy for all the copying, and parse its output into your application. – paddy Jul 07 '20 at 02:21
  • For Windows, see an example at [CopyFileEx with progress callback in Qt](https://stackoverflow.com/questions/19136936/copyfileex-with-progress-callback-in-qt). – dxiv Jul 07 '20 at 02:33

0 Answers0