title: IMAPI2 in VB 2008 progress bar
body: <p>I start making program that will burn CD/DVDs, and everything is okay.
  I found way to burn with IMAPI2 API, but now I have problem:
  I can't get progress bar of that burning.
  Here is code:</p>
  
  <pre><code>Dim CDD1 As New IMAPI2.MsftDiscMaster2
  Dim CDD2 As New IMAPI2.MsftDiscRecorder2
  
  Dim FSI As New IMAPI2FS.MsftFileSystemImage
  Dim CDD3 As New IMAPI2.MsftDiscFormat2Data
  
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      Dim Index = 0
      Dim UniqueID = ""
      Dim Directory
      Dim Path = "C:\lll"
      Dim result
      Dim Stream
  
      Label1.Text = "----- Started -----."
  
      UniqueID = CDD1.Item(Index)
      Label1.Text = Label1.Text &amp; vbCrLf &amp; "ID found: " &amp; UniqueID
  
      CDD2.InitializeDiscRecorder(UniqueID)
      Label1.Text = Label1.Text &amp; vbCrLf &amp; "Recorder selected!"
  
      Directory = FSI.Root
      Label1.Text = Label1.Text &amp; vbCrLf &amp; "Directory is here: " &amp; Directory.ToString
  
      CDD3.Recorder = CDD2
      Label1.Text = Label1.Text &amp; vbCrLf &amp; "Recorder 2 selected!"
  
      CDD3.ClientName = "IMAPI2 TEST"
      Label1.Text = Label1.Text &amp; vbCrLf &amp; "Client Name Selected!"
  
      FSI.ChooseImageDefaults(CDD2)
      Label1.Text = Label1.Text &amp; vbCrLf &amp; "Default selected!"
  
      Directory.AddTree(Path, False)
      Label1.Text = Label1.Text &amp; vbCrLf &amp; "Directory added!"
  
      result = FSI.CreateResultImage()
      Stream = result.ImageStream
  
      Label1.Text = Label1.Text &amp; vbCrLf &amp; "Writing content to disc..."
  
      If (CDD3.IsCurrentMediaSupported(CDD2) = True) Then
          If (CDD3.IsRecorderSupported(CDD2) = True) Then
  
              CDD3.Write(Stream)
  
          Else
              MsgBox("Not Suported Recorder!")
          End If
      Else
          MsgBox("Not Suported Media!")
      End If
  
      Label1.Text = Label1.Text &amp; vbCrLf &amp; "----- Finished -----"
  
  End Sub
  </code></pre>
  
  <p>When command</p>
  
  <p><strong>CDD3.Write(Stream)</strong></p>
  
  <p>is triggered, program freeze, and don't respond until data is burned completely.</p>
  
  <p>Is there any way to stop this, to stop program freezing and enabling progress bar?</p>
  
  <p>Thanks. </p>