用程序打开或关闭光驱
来源:互联网 发布:身份证取年龄公式 sql 编辑:程序博客网 时间:2024/04/29 13:35
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Long, ByVal hwndCallback As Long) As Long
Private Declare Function mciGetErrorString Lib "winmm.dll" Alias "mciGetErrorStringA" (ByVal dwError As Long, ByVal lpstrBuffer As String, ByVal uLength As Long) As Long
Public Function inoutcdrom(whichcdrom As String, incdrom As Boolean) As Integer
Dim error As String * 255
inoutcdrom = mciSendString("open cdaudio!" + whichcdrom + " alias mm", 0, 0, 0)
If inoutcdrom <> 0 Then
mciGetErrorString inoutcdrom, error, 255
MsgBox error
Exit Function
End If
If Not incdrom Then
inoutcdrom = mciSendString("set mm door open", 0, 0, 0)
Else
inoutcdrom = mciSendString("set mm door closed", 0, 0, 0)
End If
If inoutcdrom <> 0 Then
Exit Function
End If
inoutcdrom = mciSendString("close mm", 0, 0, 0)
End Function
使用:
打开光驱:
inoutcdrom 光驱盘符,false
关闭光驱:
inoutcdrom 光驱盘符,true
- 用程序打开或关闭光驱
- 用PowerShell打开或关闭光驱
- C++打开或关闭光驱
- 用C#打开关闭光驱
- 用VB6.0打开和关闭光驱
- C# 打开关闭光驱
- VBS 打开关闭光驱
- 打开、关闭光驱的方法
- 打开和关闭光驱(十五)
- 用asp打开光驱!
- 编程控制光驱打开和关闭
- Delphi实现打开和关闭光驱
- c#打开关闭CD/DVD光驱代码
- 用API关闭或打开显示器
- C# 或C++ 控制系统光驱弹出或关闭
- 打开或关闭闪光灯
- Android 利用程序实现GPS的打开或关闭
- Android中如何通过程序打开或关闭GPS
- 多媒体文件I/O
- 俄罗斯方块源代码
- [团队管理]唐僧在如来面前吐真言——西游记之团队管理漫谈
- VB6.0 RichTextBox与.Net RichTextBox的差别
- 在.NET环境下将报表数据导出EXCEL和WORD
- 用程序打开或关闭光驱
- Visual C++编程疑难问题解
- 象骆驼那样生活
- VC++中使用内存映射文件处理大文件
- Java在Linux下不能处理图形的解决办法
- 中国软件:10个人 20年坎坷路(转载)
- java的一些概念和深入
- 小巧工具--图片浏览器
- 孟子E章打印的修改版