Sign in to follow this  
Followers 0
BigDaddyO

Burning CD's with ActiveX control

6 posts in this topic

#1 ·  Posted (edited)

I found an ActiveX control called Data Burner. It's $100 for a developer license but you can download a free Trial version to play with that has VB and C examples.

EDIT: Just found out the hard way that this does not work with Vista!, yet their web site says it will

Here is some working code that I am using for my POC Backup script.

$FileToBurn = "D:\Temp\Testfile.txt"
$TargetFolder = "9"
$Volume = "Backup"
$DBCheckSize = ObjCreate("DATABURNER.databurnerCtrl.1")
if IsObj($DBCheckSize) Then
    $DBCheckSize.InitControl
    $DBCheckSize.Drive=0
    if $DBCheckSize.GetMediaFreeSpace < FileGetSize($FileToBurn) Then
        MsgBox(0, "Media error", "Not enough free space available on the inserted media")
        Exit
    EndIf
EndIf
$DBurn = ObjCreate("DATABURNER.databurnerCtrl.1")
$DBurnEvent = ObjEvent($DBurn, "databurner1_") ;<- Does not seem to work
if IsObj($DBurn) Then
    With $DBurn
        .InitControl
        .CreateFolder($TargetFolder & "\")
        .addfile($TargetFolder & "\",$FileToBurn)
        .Drive=0
        .VolumeName = $Volume
        .burn(False,False,True)
    EndWith
    ProgressOn("Backup to CD", "Your Data is being Backed up", "Initilizing the CD-R Drive", 0, 0)
    While 1
        sleep(10)
    WEnd
Else
    MsgBox(0, "", "Failed to create object")
EndIf

Func DataBurner1_ClosingDisc($Seconds)
    ProgressSet(100, "Closing Current Session")
    sleep($Seconds * 1000)
    ProgressOff()
    MsgBox(0, "Finished", "Finished creating CD")
    Exit
EndFunc

Func Databurner1_Progress($CompletedSteps, $TotalSteps)
    $BurnPercent = Round(($CompletedSteps / $TotalSteps) * 100)
    ProgressSet($BurnPercent, "Percent Complete = " & $BurnPercent)
EndFunc

Func DataBurner1_($Message)
    MsgBox(0, "Unknown Message", $Message)
EndFunc

If anybody has any ideas on how to get the ObjEvent to work I would really appreciate some feedback.

edit: Updated Code, now Fully functional

Mike

Edited by MikeOsdx

Share this post


Link to post
Share on other sites



Share this post


Link to post
Share on other sites

Cool,

I got it working. For some strange reason AutoIT can't read the ErrorEvent or the BurnComplete events from the Data Burner.

I have got it working by using the Progress event to display a decent progress screen, then I use the ClosingDisc event which returns the estimated time for closing to sleep the program that long. It's not very acurate for the first burn on the CD but all other burns are almost exact.

Mike.


Share this post


Link to post
Share on other sites

hi

have you tried to use the nero object also?

Share this post


Link to post
Share on other sites

hi

have you tried to use the nero object also?

You would have to have a Nero License for each computer that would be using it, Right?

With this Data Burner, it's a developer license, so I distribute the files with my exe and the end user doesn't have to have Nero or purchase anything else.

Mike


Share this post


Link to post
Share on other sites

hi

i understand - thats a good point

i work for a bigger company so the lic for nero was already there , i wrote interface with c++ once using the nero toolkit..

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0