can anyone suggest me how can i burn and read data from cd rom in c# language.???
5 2871 PsychoCoder 465
Recognized Expert Moderator Contributor
Bytes.com isn't a code or homework service, we're a community of like minded people who come together to help those who are willing to help themselves.
Show us what you've tried and we will do everything we can to nudge you in the right direction but we will not just do the work for you.
this is the code what i have now...... -
using System;
-
using System.Collections.Generic;
-
using System.Linq;
-
using System;
-
using System.IO;
-
using System.Runtime.InteropServices;
-
using System.Text;
-
-
class CSburnD
-
{
-
[DllImport("shfolder.dll")]
-
static extern int SHGetFolderPath(IntPtr hwndOwner, int nFolder,
-
IntPtr hToken, int dwFlags,
-
StringBuilder pszPath);
-
-
const int CSIDL_CDBURN_AREA = 0x3B;
-
const int SHGFP_TYPE_CURRENT = 0;
-
-
public static void Main(string[] args)
-
{
-
StringBuilder szPath = new StringBuilder(1024);
-
if (SHGetFolderPath((IntPtr)0, CSIDL_CDBURN_AREA, (IntPtr)0,
-
SHGFP_TYPE_CURRENT, szPath) != 0)
-
Console.WriteLine("SHGetFolderPath() failure");
-
else
-
Console.WriteLine("SHGetFolderPath return value = " + szPath);
-
Console.Read();
-
-
Guid CLSID_CDBurn = new Guid("fbeb8a05-beee-4442-804e-409d6c4515e9");
-
-
Type t = Type.GetTypeFromCLSID(CLSID_CDBurn);
-
if (t == null)
-
{
-
Console.WriteLine("ICDBurn not supported by OS");
-
Console.Read();
-
return;
-
}
-
-
ICDBurn iface = (ICDBurn)Activator.CreateInstance(t);
-
if (iface == null)
-
{
-
Console.WriteLine("Unable to obtain interface");
-
Console.Read();
-
return;
-
}
-
-
bool hasRecorder = false;
-
iface.HasRecordableDrive(ref hasRecorder);
-
Console.WriteLine("HasRecordableDrive return value = " + hasRecorder);
-
Console.Read();
-
if (hasRecorder)
-
{
-
StringBuilder driveLetter = new StringBuilder(4);
-
iface.GetRecorderDriveLetter(driveLetter, 4);
-
Console.WriteLine("GetRecorderDriveLetter return value = " +
-
driveLetter);
-
Console.Read();
-
iface.Burn((IntPtr)0);
-
}
-
}
-
}
-
-
[ComImport]
-
[Guid("3d73a659-e5d0-4d42-afc0-5121ba425c8d")]
-
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
-
public interface ICDBurn
-
{
-
void GetRecorderDriveLetter([MarshalAs(UnmanagedType.LPWStr)]
-
StringBuilder pszDrive, uint cch);
-
void Burn(IntPtr hwnd);
-
void HasRecordableDrive(ref bool HasRecorder);
-
-
}
Rabbit 12,516
Recognized Expert Moderator MVP
And is there something wrong with the code? You haven't told us anything about it.
No there is nothing wrong with the above code... it works properly..
Rabbit 12,516
Recognized Expert Moderator MVP
So then this thread is resolved and you need no further assistance?
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: S Austin |
last post by:
Discovered recently (duh) that putting inline code in .h files (e.g.
in class definitions) is not a good idea when building DLLs and the
applications that use those DLLs. The reason being, of course, is
that the application gets its own copy of that code when it compiles
and won't call the code in the DLL. Each compiled unit in the DLL also
ends up with its own copy of the never-called code.
Assuming the same build process for the DLL...
|
by: none |
last post by:
Hi,
Any one know of some code to read cobol data files....
thanks
timb
|
by: Kay |
last post by:
IIS cannot read files in a directory reporting that :
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'Fso.GetFolder'
This has to do with Scripting.FileSystemObject.
I make sure the scrrun.dll is properly registered with regsvr32.
Still the problem persists.
Previously I do not know what I did right once in permission setting and
|
by: John E Katich |
last post by:
When attempt to use the Event Wizard I get the following error message:
"Add/Remove of the function impossible, because the parent class code is
read only"
The Project was convert from VC 6.0. The files in question do not have the
Read-Only Attribute on.
Any Ideas?
|
by: Argirop |
last post by:
I started recently with asp.net 2.0 and I am currently trying to generate the
mysite.dll by compiling the corresponding code behind .cs files. I am using
the csc tool that displays one CS0103 error message (The name '...' does not
exist in current context) for every control id that I am using in the .ascx
files ('...' is the id of the control).
From one point of view this is logical since there are no anymore
declarations for the page...
| |
by: IVETH |
last post by:
Hi
Can anyone provide an example of how to read files in java and upload this information to the database ?
Thanks
|
by: smartjoe85 |
last post by:
can anyone give me a program to read files from my harddisk from dos environment
|
by: alivip |
last post by:
how to ingrate my code to read text in in parent folder contain sub folders and files for example folder name is cars and sub file is Toyota,Honda and BMW and Toyota contain file name Camry and file name corolla, file name Honda contain folder accord and BMW contain file name X5
Is there way to enter name of parent folder(cars) and search in all sub folder(Toyota,Honda and BMW) and files ?
please help ASAP
code is find most frequent...
|
by: pritdongare |
last post by:
hiiiii,
pritam here.
i m doing xml parsing,,in dis i hav to take xml files one by one from folder and then parse them,,In this i won to know how to read files from folder.plz try to reply fast.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |