by ojas (14 Submissions)
Category: Windows API Call/Explanation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Thu 1st December 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Use this program as a shrtcut to open or close your CD ROM. USE F11 to eject f12 to close and f10 to end this program
API Declarations
Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Global Const VK_F11 = &H7A
Global Const VK_F12 = &H7B
Global Const VK_F10 = &H79
GEN. DECLARATIONS(NOT IN MODULE)
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 Sub Form_Load()
Dim s As String
s = MsgBox("Use this program to open or close your cd rom quickly press F11 to eject CD ROM and F12 to close CD ROM and F10 to end this program ", vbInformation)
Form1.Hide
End Sub
Private Sub Timer1_Timer()
Dim s, d
If GetAsyncKeyState(VK_F11) Then
s = mciSendString("set cdaudio door open", 0, 0, 0)
ElseIf GetAsyncKeyState(VK_F12) Then
d = mciSendString("set cdaudio door closed", 0, 0, 0)
ElseIf GetAsyncKeyState(VK_F10) Then
s = MsgBox("Program is aborted by user", vbInformation)
End
End If
End Sub
No comments have been posted about Use this program as a shrtcut to open or close your CD ROM. USE F11 to eject f12 to close and f10 t. Why not be the first to post a comment about Use this program as a shrtcut to open or close your CD ROM. USE F11 to eject f12 to close and f10 t.