首页 > 开发 > 综合 > 正文

C#如何打开关闭CDROM

2024-07-21 02:20:11
字体:
来源:转载
供稿:网友
using system;
using system.text;
using system.runtime.interopservices;

class closecd
{

[dllimport( "winmm.dll", entrypoint="mcisendstringa", charset=charset.ansi )]
protected static extern int mcisendstring( string lpstrcommand, stringbuilder lpstrreturnstring, int ureturnlength, intptr hwndcallback );

public static void main()
{

int ret = mcisendstring( "set cdaudio door open", null, 0, intptr.zero );

console.readline();

ret = mcisendstring( "set cdaudio door closed", null, 0, intptr.zero );
}
}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表