Open CD/DVD door with a Windows API call?

拈花ヽ惹草 提交于 2019-11-28 05:19:04

问题


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


回答1:


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: Windows CDROM Eject.




回答2:


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)



回答3:


[DllImport("winmm.dll")]
static extern Int32 mciSendString(string command, string buffer, int bufferSize, IntPtr hwndCallback);

//Open
mciSendString("set CDAudio door open", "", 127, IntPtr.Zero);

//Close
mciSendString("set CDAudio door closed", "", 127, IntPtr.Zero);


来源:https://stackoverflow.com/questions/1829342/open-cd-dvd-door-with-a-windows-api-call

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!