惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Hugging Face - Blog
Hugging Face - Blog
量子位
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
MongoDB | Blog
MongoDB | Blog
小众软件
小众软件
爱范儿
爱范儿
博客园 - 【当耐特】
Vercel News
Vercel News
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
F
Fortinet All Blogs
Apple Machine Learning Research
Apple Machine Learning Research
GbyAI
GbyAI
博客园 - 叶小钗
博客园_首页
V
Visual Studio Blog
宝玉的分享
宝玉的分享
B
Blog
MyScale Blog
MyScale Blog
C
Check Point Blog
博客园 - 三生石上(FineUI控件)
L
LangChain Blog
V
V2EX

博客园 - walker

[转]有一种爱叫索取 悟空,真的是空? Interpreter解释器(行为型模式) Command命令(行为型模式) TemplateMethod模板方法(行为型模式) Proxy代理(结构型模式) Flyweight享元(结构型模式) Facade外观(结构型模式) Decorator装饰(结构型模式) Composite组合(结构型模式) Singleton单件(创建型模式) Bridge桥接(结构型模式) Adapter适配器(结构型模式) Prototype原型(创建型模式) Builder生成器(创建型模式) AbstractFactory抽象工厂(创建型模式) FactoryMethod工厂方法(创建型模式) 一个C#睡前故事 C#中得到网卡号
C#怎样打开关闭CDROM?
walker · 2006-02-21 · via 博客园 - walker

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 );
  }
}