tags:

views:

270

answers:

2

How do I open the CD/DVD door with a Windows API call?

+4  A: 

If you're using .NET this will work:

http://www.dotnetspider.com/resources/15834-eject-close-cd-tray.aspx

It was the first link to come up when I googled "win api open cd door".

This was the second one: http://stackoverflow.com/questions/58670/windows-cdrom-eject.

David Stratton
Actually I had to do that from Lua. But thanks, your answer was very helpful.
+1  A: 

If anyone else is interested, here is a short draft of how it can be done in Lua:

require ("alien")

local kolbasz = alien.winmm.mciSendStringA
kolbasz:types{ ret = 'long', abi = 'stdcall', 'string', 'string', 'long', 'long'}
kolbasz("set cdaudio door open", null, 0, 0)