PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Does anyone know how to do it? I thought it'd be pretty cool. I know in Linux, there's an eject command that can be executed through exec(). How about in Windows? This is just something cool, wondering how to do it for further reference.
evilmonkey wrote:Does anyone know how to do it? I thought it'd be pretty cool. I know in Linux, there's an eject command that can be executed through exec(). How about in Windows? This is just something cool, wondering how to do it for further reference.
In windoze you can do virtually anything via com objects. PHP/Win does support COM, hence you can open cd tray of a windows server. Here's VBScript code:
Const CDROM = 4
For Each d in CreateObject("Scripting.FileSystemObject").Drives
If d.DriveType = CDROM Then
Eject d.DriveLetter & ":"
End If
Next
Sub Eject(CDROM)
Dim ssfDrives
ssfDrives = 17
CreateObject("Shell.Application")_
.Namespace(ssfDrives).ParseName(CDROM).InvokeVerb("E&ject")
End Sub
Translating it into PHP code should be fairly simple and straightforward.