[python-win32] Eject a CD with win32file?
Jeff Shannon
jeff@ccvcorp.com
Mon, 25 Nov 2002 09:56:08 -0800
> From: Joel Lawhead <jlawhead@bellsouth.net>
>
> Hi,
> I'm trying to programatically eject a cd on a Win2k machine in Python.
[...]
> The second parameter in DeviceIoControl is an integer but I don't know
> what it is and have been guessing with several numbers to no avail. All
> the documentation simply refers to the constant
> "IOCTL_STORAGE_EJECT_MEDIA" and not an integer. So I'm not sure if that
> call is my problem or if it's something else.
Look for the win32con module, which defines (almost) all of the constants in
the Win32 API. You should be able to use win32con.IOCTL_STORAGE_EJECT_MEDIA
as your parameter. (Warning -- I haven't verified that this constant is
defined there, but this is the general format that works for most Win32
constants.)
Jeff Shannon
Technician/Programmer
Credit International