title: How to take a screenshot of application using QTP?
body: <p>I want to take a screen shot of application when error occurs &amp; save it in a specific folder. Below code works but it doesnt take a screen shot of application, it takes a screen shot of QTP Code screen. </p>
  
  <pre><code>Function CaptureImage()
      Dim Date_Time
      Dim Myfile
      Date_Time=Now() 
      Myfile= Date_Time&amp;".png"
      Myfile = Replace(Myfile,"/","-") 
      Myfile = Replace(Myfile,":","-")
      Myfile= "C:\"&amp;Myfile 
      Desktop.CaptureBitmap Myfile, True
  End Function
  </code></pre>