Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: C and Cpp Programming in C and Cpp CD Drive Control Tutorial

Enumerates all CD-ROM drives and allows them to be opened and closed at the touch of a button.

Tutorial Details:

Geekpedia Programming tutorial: CD Drive Control

I got bored the other day and was looking through the Platform SDK Documentation and came across the DeviceIoControl API function. I came upon the IOCTL_STORAGE_EJECT_MEDIA control code and it got my interest. I decided to make a small application that made use of DeviceIoControl and the IOCTL_STORAGE_EJECT_MEDIA and IOCTL_STORAGE_LOAD_MEDIA control codes.

This project was done with MFC in Microsoft Visual C++ 6.0 and is compatable with Windows NT/2000/XP.

Before getting into the nitty gritty of how to open and close a CD-ROM drive (which isn't all that hard actually) I'm going to show you how to enumerate all CD-ROM devices on the system and display them. This part is really only applicable to this program or anything that will impliment this in the exact same way (but it's a good lesson in how to use CListCtrl).

First create a new MFCApp Wizard (exe) project. For the purposes of this project we will be using a a dialog based application without any context based help or any other extra stuff.

Open up the main dialog and add a List Control to the dialog. Right click the control and click 'Properties'. Click the 'Styles' tab and check the select the 'List' option in the 'View' drop down list and close the 'Properties' window. Now right click the List Control again and select 'Class Wizard'.

In the window that appears click the 'Member Variables' tab and select the Control ID for the List Control you just created and then click the 'Add Variable' button. Enter the name of the variable and click 'OK'. You have now just created a CListCtrl which is mapped to the List Control you placed in the Dialog.


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
C and Cpp Programming in C and Cpp CD Drive Control Tutorial

View Tutorial:
C and Cpp Programming in C and Cpp CD Drive Control Tutorial

Related Tutorials:

Java Q&A - Java Still Open
Java Q&A - Java Still Open
 
Opening up new ports to Java with javax.comm - JavaWorld - September 1998
Opening up new ports to Java with javax.comm - JavaWorld - September 1998
 
Smart object-management saves the day - JavaWorld November 1999
Smart object-management saves the day - JavaWorld November 1999
 
C# : A language alternative or just J--? (part1)
C# : A language alternative or just J--? (part1)
 
C#: A language alternative or just J--?, Part 2 - JavaWorld December 2000
C#: A language alternative or just J--?, Part 2 - JavaWorld December 2000
 
Integrate Java and C++ with Jace
Integrate Java and C++ with Jace
 
The J2EE 1.4 Tutorial
The J2EE 1.4 Tutorial is a guide to developing enterprise applications for the Java 2 Platform, Enterprise Edition (J2EE) version 1.4. Here we cover all the things you need to know to make the best use of this tutorial.
 
JTwain
JTwain will implement a Java interface to the the Win32 C DLL TWAIN acquire methods.
 
Servlet Essentials
This document explains the concepts of Java Servlets and provides a step-by-step tutorial for writing HTTP Servlets with complete source code for the example Servlets. The tutorial and the other chapters cover all facets of Servlet programming from a ...
 
Java Technology Fundamentals
Learn how to use variable arguments lists, the new JConsole utility to monitor applications, and discover ways to learn what you need to know to get Sun certified.
 
10 Minutes Guide to Ant
10 Minutes Guide to Ant 10 Minutes Guide to Ant Previous Tutorial Index Next Introduction Well for the next 10 minutes get ready to devote to the ant guide. This will make some sence to the ant. Ant is a free tool under GNU Licence and is
 
Building Web Application With Ant and Deploying on Jboss 3.0
Building Web Application With Ant and Deploying on Jboss 3.0 Building Web Application With Ant and Deploying on Jboss 3.0 Previous Tutorial Index Next In this lesson I will show you how to build you web application and install on the Jboss 3.0
 
We are providing Knoppix 3.4 Live Linux CD's
We are providing Knoppix 3.4 Live Linux CD's Knoppix Linux CD's Now Available Linux Knoppix 3.4 CD's What is KNOPPIX? KNOPPIX is a bootable Linux CD with a collection of various GNU/Linux software. It auto-detects hardware and supports many
 
We are providing Knoppix 3.6 Live Linux CD's
We are providing Knoppix 3.6 Live Linux CD's Knoppix Linux CD's Now Available Linux Knoppix 3.6 CD's What is KNOPPIX? KNOPPIX is a bootable Linux CD with a collection of various GNU/Linux software. It auto-detects hardware and supports many
 
We are providing Knoppix 3.7 Live Linux CD's
We are providing Knoppix 3.7 Live Linux CD's Knoppix Linux CD's Now Available Linux Knoppix 3.7 CD's What is KNOPPIX? KNOPPIX is a bootable Linux CD with a collection of various GNU/Linux software. It auto-detects hardware and supports many
 
We are providing Linux CD's for free.
We are providing Linux CD's for free. Knoppix Linux CD's Now Available Linux Knoppix 3.3 CD's What is KNOPPIX? KNOPPIX is a bootable Linux CD with a collection of various GNU/Linux software. It auto-detects hardware and supports many graphics
 
We are providing Downloadable Version of Mandrake Move Linux
We are providing Downloadable Version of Mandrake Move Linux Mandrake Move Live Linux Now Available Linux Mandrake Move Live CD's We are providing the free downloadable version of Mandrake Official Move Live, which is distributed under GNU public
 
Buy SuSe 9.2 Live CDs in India from us. Suse 9.2 Live is available with us.
Buy SuSe 9.2 Live CDs in India from us. Suse 9.2 Live is available with us. SuSe 9.2 Live Linux Now Available SuSe 9.2 Live CD's SuSe Linux 9.2 is Linux that boots from CD ROM. You don't have to install it on your system to use it. Simply insert
 
New Technical Articles: 64-bit Programming on Solaris 10 OS for x86 Platforms
Four technical articles describe the new Sun Studio 10 software's 64-bit programming features on the Solaris 10 OS for x86 and AMD64 platforms. Important issues regarding the AMD64 ABI (Application Binary Interface), debugging, migration to 64-bits, and p
 
Solaris 10 OS Released
The Solaris 10 Operating System is now officially a production release. Download it today at no cost and see how Solaris software can make a difference for you.
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.