Windows Scripting
  Home arrow Windows Scripting arrow Page 3 - 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 - Preparing a Disc Image


    (Page 3 of 4 )

    Now you’ll need to initialize the burn device and begin preparing a disc image to write. Remember that files cannot be copied directly to a CD. Instead, an image of the new disc's file system must be created first and then written to the disc.

    Set objRecorder = WScript.CreateObject("IMAPI2.MsftDiscRecorder2")

    strDevice = objDiscMaster.Item(intIndex)

    objRecorder.InitializeDiscRecorder(strDevice)

    Continuing with the burn script, you’ll need to connect to the IMAPI DiscRecorder object. This is an object that will be used to reference the CD burner that will be used to write the disc. You’ll first need to retrieve the device identifier string from the DiscMaster object. Then, you must attach the device to the Recorder object reference using the InitializeDiscRecorder method.

    This is overly complicated. This is just a fancy way of telling the IMAPI control what device we want to use as a burner.

    Set objImageWriter = CreateObject("IMAPI2.MsftDiscFormat2Data")

    objImageWriter.Recorder = objRecorder

    objImageWriter.ClientName = "IMAPI Script"

    IMAPI’s MsftDiscFormat2Data interface is used to create an image writer object.  You can then specify a recording device using the Recorder property. The ClientName property is used to specify a friendly name for the image writer client.

    Set objFSI = CreateObject("IMAPI2FS.MsftFileSystemImage")

    objFSI.ChooseImageDefaults(objRecorder)

    Now that the recording device has been selected and initialized, it’s time to begin building the actual burn image. The MsftFileSystemImage interface is used to create an image object.  Think of this as a kind of empty ISO file.

    You must also specify the type of file system to use along with the other settings for the image. This is most easily done by using the ChooseImageDefaults method. This method will examine the provided device and its current media and set the image settings accordingly.

    objFSI.FileSystemsToCreate = 1

    Rather than using the ChooseImageDefaults method, you may specify a file system for the resulting image if you wish. This can be accomplished using the FileSystemToCreate property. The possible choices are listed in the table below.

    FsiFileSystemISO9660

    1

    FsiFileSystemJoliet

    2

    FsiFileSystemUDF

    3

    More Windows Scripting Articles
    More By Nilpo


     

    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 5 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek