Windows Scripting
  Home arrow Windows Scripting arrow Page 4 - Burning CDs with the IMAPI2 Control
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
WINDOWS SCRIPTING

Burning CDs with the IMAPI2 Control
By: Nilpo
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-11-03

    Table of Contents:
  • Burning CDs with the IMAPI2 Control
  • Identifying a Supporting Device
  • Preparing a Disc Image
  • Burning the Disc

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Burning CDs with the IMAPI2 Control - Burning the Disc


    (Page 4 of 4 )

    Set objDir = objFSI.Root

    objDir.AddTree strPath, False

    Next, you need to add a directory structure to the newly created disc image. The AddTree method accepts two parameters. The first parameter is a string indicating the path to the folder that contains the files to be burned. The second parameter is a Boolean value that indicates whether or not the folder itself should be included in the image or whether the image should just contain the folder’s subfolders and files.

    Set objImage = objFSI.CreateResultImage()

    Stream = objImage.ImageStream

    Finally, the image needs to be created from the files provided using the CreateResultImage method. This is similar to saving an ISO image of the disc you are creating. Once the image is created, you can create a reference to the image stream. The image is not written to disc as a whole; instead, the image is streamed and written on piece at a time.

    objImageWriter.Write(Stream)

    Once you have an image stream, you can return to the ImageWriter object and start the actual burn process using the Write method. At this point, control will not return to your script until the burn process has completed.

    The script that we’ve put together is just a basic example of what you can accomplish using the IMAPI2 control. There are several other methods available that can be used for error-checking as well as methods that can be used to further control the recorder by handling advanced settings such as write speed.  For more information, check out the MSDN documentation for the IMAPI2 Reference.

    Unfortunately, that’s all the space that I have for today.  This should put you well on your way to writing scripts capable of burning data CDs using the IMAPI2 control. Don’t be afraid to play around with this script and see what you can accomplish. You may end up throwing away some CDs, but I think you’ll have some fun in the process. Until next time, keep coding!


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

     

    WINDOWS SCRIPTING ARTICLES

    - More Windows Scripting Workarounds from Nilpo
    - Overloading Methods and More in VBScript
    - Improving MFC for Windows Vista
    - Regular Expressions in VBScript
    - Working with Dates in WMI
    - Completing Calendars with VBScript Date Func...
    - Building Calendars with VBScript Date Functi...
    - Working With Dates and Times in VBScript
    - Designing WCF DataContract Classes Using the...
    - Understanding Dates and Times in VBScript
    - Working With Arrays in VBScript
    - Compressed Folders in WSH
    - Using .NET Interops in VBScript
    - Nilpo`s Scripting Secrets, Vol I
    - Database operations using Silverlight 2.0 WC...





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek