No guarantees, but I would expect this to go through a call to the DeviceIoControl() function.

Most likely, the IOCTL_STORAGE_EJECT_MEDIA or IOCTL_STORAGE_MEDIA_REMOVAL is the IO control code you need.

There is an article on MSDN on how to programmatically eject media. PSS ID 165721
http://support.microsoft.com/default...b;en-us;165721