CD RW filecopy

  • Thread starter Thread starter Pepi Tonas
  • Start date Start date
P

Pepi Tonas

Hi All,

I am trying to add a backup feature to an application that I am
developing.

Windows XP supports dragging and dropping files into a CD-RW unit,
later letting you know (balloon through) that you have files to write.
So I was trying to find a method using this XP built in feature to,
from my application copy files into a CD-R disc.

I am using VB .NET and the file.copy function from system.io, as
expected gets a denied access erro when trying to copy to the cd-rw.

Any help will be highly appreciated.
 
Hi,

Here is how to copy a file to the cd burn area. The SHGetFolderPath
api call will get the path of the cd burn area. You need to add imports
system.interop.runtimeservices to the top of the code file.

<DllImport("shell32.dll", entrypoint:="SHGetFolderPathW", _

setlasterror:=True, CharSet:=CharSet.Auto, exactspelling:=True, _

CallingConvention:=CallingConvention.StdCall)> _

Public Shared Function SHGetFolderPath(ByVal hWnd As Integer, _

ByVal nFolder As Integer, ByVal nToken As Integer, _

ByVal dwFlags As Integer, _

<MarshalAs(UnmanagedType.LPTStr)> ByVal lpszPath As String) As Boolean

End Function



Const CSIDL_CDBURN_AREA = &H3B

Dim strPath As String = Space(260)

If SHGetFolderPath(Me.Handle.ToInt32, CSIDL_CDBURN_AREA, 0, 0, strPath) = 0
Then

strPath = strPath.Trim

strPath = strPath.Substring(0, strPath.Length - 1)

strPath += "\Test.doc"

System.IO.File.Copy("C:\test.doc", strPath)

End If


Ken
 
* Pepi Tonas said:
I am trying to add a backup feature to an application that I am
developing.

Windows XP supports dragging and dropping files into a CD-RW unit,
later letting you know (balloon through) that you have files to write.
So I was trying to find a method using this XP built in feature to,
from my application copy files into a CD-R disc.

I am using VB .NET and the file.copy function from system.io, as
expected gets a denied access erro when trying to copy to the cd-rw.

You will have to go via IMAPI.

Notice that it's hard to use IMAPI with VB.NET directly. Typically it
is used with C++:

<http://www.gotdotnet.com/team/cplusplus/samples/cd burning.zip>
 
Dear Ken,

10^24 Thanks... Exactly what I needed

Hi,

Here is how to copy a file to the cd burn area. The SHGetFolderPath
api call will get the path of the cd burn area. You need to add imports
system.interop.runtimeservices to the top of the code file.

......
 
Is there a way to automate the process further on by, after copying
the files to the CDR temp, actually commanding the CDRW to start the
burn process?

Thanks again...
 
Back
Top