| | |
Controlling Hardware
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2004
Posts: 489
Reputation:
Solved Threads: 5
To me you have not even shown an effort. If you notice this board helps other coders to become better codes - this is only going to take place when one posts up his / her code and let us see what they understand. Such demands like these won't help anyone nor yourself to become a better coder! I'm not sure that you even know the basics never mind playing around with the API interface!
Hi AcidBurn and Narue,
Sorry for my bad attidute. Just so you know, this wasn't a class assignment(I'm not even in a programming class). I was actually trying to make a CD player.
Thanks for telling me to look at msdn.microsoft.com.
AcidBurn, I actually have absolutely no idea how to do this. I just started learning C++ and I'm still a beginner.
--
C++
Sorry for my bad attidute. Just so you know, this wasn't a class assignment(I'm not even in a programming class). I was actually trying to make a CD player.
Thanks for telling me to look at msdn.microsoft.com.
AcidBurn, I actually have absolutely no idea how to do this. I just started learning C++ and I'm still a beginner.
--
C++
•
•
Join Date: Dec 2004
Posts: 489
Reputation:
Solved Threads: 5
Then I strongly suggest you start from the beginning, either by taking a programming course, or attempt to get a book and work through! Don't expect to find yourself playing with that sort of stuff soon! I've had almost 1 yer doing C and C++...and we havent even started that yet! (Next year) ..........
Here what I like to call the lazy man's method!
Interprocess communication can help improve the functionality of your program.
// Command line approach
#include <stdlib.h>
...
// To open
system("wineject -open d:"); // Note: d: can be any letter you pick.
// To close
system("wineject -close d:"); // Note: d: can be any letter you pick.
-----------------------------------------------------------
// Windows Approach
#include <windows.h>
...
//To Open
WinExec("wineject -open d:", SW_HIDE);
//To close
WinExec("wineject -close d:", SW_HIDE);
------------------------------------------------------------
Hope this helps, you can get wineject from: http://www.bountyx.net/files/wineject.exe
The above assumes that wineject.exe is in the same location as your program's exe. If you wish to use configurable drive letters with the commands you must get rid of the "d:" part and concatenate your own drive letter to the string.
------------------------------------------------------------
That's the easy, interprocess communication approach. Now lets use something more direct. You expressed using Windows XP. Luckily, there is API support for this type of communication. This is what your looking for: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/imapi_interfaces.asp
The IMAPI interface through the windows api will make things a breeze =) . Documentation and examples available at MSDN.com .
Now lets take it a step further. How does communication with the CDROM work? Well it is true that the API may handle this a little differently as you go from platform to platform, but layers exist to compensate for procedures that are not explicitly available in the API.
Such layers are ASPI layers and IMAPI layers. In fact, Nero provides a free aspi layer. WinAspi.dll is also an option (but only for windows). For more information about a [almost] platform independent approach to communicating with the CDROM drives, see http://cdrecord.berlios.de/old/private/cdrecord.html
CDRECORD implements an ASPI layer to provide a common interface to interact with CDROM drives. Not only can you eject a cd, you can write data!
Good Luck!
Interprocess communication can help improve the functionality of your program.
// Command line approach
#include <stdlib.h>
...
// To open
system("wineject -open d:"); // Note: d: can be any letter you pick.
// To close
system("wineject -close d:"); // Note: d: can be any letter you pick.
-----------------------------------------------------------
// Windows Approach
#include <windows.h>
...
//To Open
WinExec("wineject -open d:", SW_HIDE);
//To close
WinExec("wineject -close d:", SW_HIDE);
------------------------------------------------------------
Hope this helps, you can get wineject from: http://www.bountyx.net/files/wineject.exe
The above assumes that wineject.exe is in the same location as your program's exe. If you wish to use configurable drive letters with the commands you must get rid of the "d:" part and concatenate your own drive letter to the string.
------------------------------------------------------------
That's the easy, interprocess communication approach. Now lets use something more direct. You expressed using Windows XP. Luckily, there is API support for this type of communication. This is what your looking for: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/imapi_interfaces.asp
The IMAPI interface through the windows api will make things a breeze =) . Documentation and examples available at MSDN.com .
Now lets take it a step further. How does communication with the CDROM work? Well it is true that the API may handle this a little differently as you go from platform to platform, but layers exist to compensate for procedures that are not explicitly available in the API.
Such layers are ASPI layers and IMAPI layers. In fact, Nero provides a free aspi layer. WinAspi.dll is also an option (but only for windows). For more information about a [almost] platform independent approach to communicating with the CDROM drives, see http://cdrecord.berlios.de/old/private/cdrecord.html
CDRECORD implements an ASPI layer to provide a common interface to interact with CDROM drives. Not only can you eject a cd, you can write data!
Good Luck!
A Hacker's Mind:
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes..." - J.D.Salinger
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes..." - J.D.Salinger
![]() |
Similar Threads
- Controlling Hardware (Java)
- Tutorial on Hardware in C (C)
Other Threads in the C++ Forum
- Previous Thread: linking open gl
- Next Thread: parking fee
| Thread Tools | Search this Thread |
api array based beginner binary bitmap c++ c/c++ calculator char char* class code coding compile compiler console conversion count database delete deploy developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int java lib linkedlist linker list loop looping loops map math matrix memory multiple news node number numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference rpg sorting string strings temperature template test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






