| How to open and close CD-ROM drive |
Applies To |
|
| OS: VB: |
NT, 9x, 2000 4, 5, 6 |
|
Occasionally, we all want to write a program that will goof on someone. Why not write a program that opens and closes the CD-ROM drive constantly? Here is how:
| Add the following to a Form, Module or Class Module |
|---|
Option Explicit
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
Public Sub OpenCdDoor()
Dim sReturn As String
Const RETURN_SIZE = 127
mciSendString "set Cdaudio door open", sReturn, RETURN_SIZE, 0
End Sub
Public Sub CloseCdDoor()
Dim sReturn As String
Const RETURN_SIZE = 127
mciSendString "set Cdaudio door closed", sReturn, RETURN_SIZE, 0
End Sub
| Remarks |
|---|