|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
I need a little help with using VB to burn files to a CD (Unattended).
I have established a resource library on my server.
I am creating a vb application to act as a simple User Interface to make it easier for my customers to get the resources they want. I would like for them to click an action button and for the following events to occur: 1) CD Tray opens and prompts user to put a blank CD in the tray (got that figured out) Code:
Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
(ByVal lpCommandString As String, ByVal lpReturnString As String, _
ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim retval As Long
retval = mciSendString("set CDAudio door open", "", 0, 0)
MsgBox("Please insert a blank CD, and close the CD Tray")
End Sub
2) When the CD tray closes, Open a cd burn list 3) Goto the following directory- \\Clfiledept\sheriff\Training Section\Admin, Training Section\Backup CD\Course CD's\Big Rigs 4) Add all the files and folders from inside the Big Rigs folder to the CD burn list (types of files associated with these folders will be ; swf, jpg, wav, asf, wmv, exe, x32, inf, a5r, u32, txt) 96.7 mb of data 5) Burn the CD 6) Eject the CD, and display message the CD is burned and ready to use. Not quite sure how to proceed from here..... |
|
#2
|
||||
|
||||
|
Found an acceptable workaround
3 days of digging and researching have led me to conclude there is no good way to do want I want from VB. This is the closest
workaround I could come up with. It seems to work, so I am happy at this point. Code:
Public Class Form1
Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
(ByVal lpCommandString As String, ByVal lpReturnString As String, _
ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Uservalue As String
Uservalue = SystemInformation.UserName
Dim retval As Long
retval = mciSendString("set CDAudio door open", "", 0, 0)
MsgBox("Please insert a blank CD, and close the CD Tray" & vbCrLf & _
"The process of burning the CD may take a few minutes", _
MsgBoxStyle.OkOnly, "Click OK to Continue")
My.Computer.FileSystem.CopyDirectory("D:\Folder1\Folder2\Folder3\TestRun", _
"C:\Documents and Settings\" & Uservalue & _
"\Local Settings\Application Data\Microsoft\CD Burning", True)
’ (“Source Directory", "Destination Directory", True)
’ CD Burn Folder Directory is: "C:\Documents and Settings\" & Uservalue & _
’ "\Local Settings\Application Data\Microsoft\CD Burning"
End Sub
End Class
The paths and files that are copied in my case are known fixed locations, I just had to come up with a way to automate the whole delivery process. When a user wants a Course on CD, he just clicks the action button and it opens the CD tray, says feed me, closes the tray and clicks OK. The program finds the directory I want copied and puts the files in the burner tray. The loading of a blank cd also conveniently opens the cd burning wizard when it detects a fresh cd. Lo and behold the files are there waiting to be written ! When it's done it ejects and clears the burn tray list. Please Note the Variable "Uservalue" which is specified in the destination path of where the temp files are written to. The CD burning utility stores the to be burned files in a folder within the profile of the user logged on to the computer. Someone improve on this please as I know it can probably be done better than a guy with a weeks experience with VB.
__________________
My Heroes.... Jesus, Abraham Lincoln, General George S. Patton, Yoda, Shadow Wizard, and Meloncolly. Sorry if someone is ahead of you but they are tough acts to beat. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > I need a little help with using VB to burn files to a CD (Unattended). |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|