title: Create a new thread in click button event c++
body: <p>I have create a gui using windows form application. I am using a button which perform some function on click event. I have noticed that the gui form freezes when the functionality of button take place. I came across with some libraries for multithreading. However I am trying to understand what should I  add in a new thread. Which library should I use? My onClick event are:</p>
  
  <pre><code>    private: System::Void button1_Click_1(System::Object^  sender, System::EventArgs^  e) {
              backgroundWorker1-&gt;RunWorkerAsync( 10 );                    
       }
      private: System::Void backgroundWorker1_DoWork(System::Object^  sender, System::ComponentModel::DoWorkEventArgs^  e) {              
               this-&gt;progressBar1 -&gt;Value = 0;
               string path = "vid/frames/";
               this-&gt;timer1-&gt;Start();
               Detection detect;
               vector&lt;string&gt; files = detect.listFile(path);
               for(int index=0; index&lt;files.size(); index++){
                   cout &lt;&lt; files.at(index) &lt;&lt;endl;
                   detect.draw(path, files.at(index), modulator, trackbar_values);
                   this-&gt;progressBar1-&gt;Increment(1);
               }
           }
  </code></pre>
  
  <p>It runs one time doWork and it stops. </p>