C # How to turn open CDROM

xiaoxiao2021-03-06  41

Want to switch CDROM in C #, you can use the following code, this is a console program. 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 = McIndstring ("Set CDAUDIO DOOR OPEN", NULL, 0, INTPTR.ZERO;

Console.readline (); RET = McISendstring ("Set CDAUDIO DOR CLOSED", NULL, 0, INTPTR.ZERO);}}

转载请注明原文地址:https://www.9cbs.com/read-78257.html

New Post(0)