cddriveopenclose.frm

 VERSION 5.00
Begin VB.Form Form1
   Caption         =   "Open/Close Cd Drive"
   ClientHeight    =   1650
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3060
   Icon            =   "cddriveopenclose.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   ScaleHeight     =   1650
   ScaleWidth      =   3060
   StartUpPosition =   3  'Windows Default
   Begin VB.CommandButton Command3
      Caption         =   "About me"
      Height          =   315
      Left            =   840
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   1200
      Width           =   1455
   End
   Begin VB.CommandButton Command2
      Caption         =   "CLOSE CD"
      Height          =   975
      Left            =   1680
      Picture         =   "cddriveopenclose.frx":0442
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   120
      Width           =   1215
   End
   Begin VB.CommandButton Command1
      Caption         =   "OPEN CD"
      Height          =   975
      Left            =   120
      Picture         =   "cddriveopenclose.frx":0884
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   120
      Width           =   1335
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
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 Command1_Click()
Screen.MousePointer = vbHourglass
retvalue = mciSendString("set CDAudio door open", returnstring, 127, 0)
Screen.MousePointer = vbNormal
End Sub

Private Sub Command1_LostFocus()
Command1.BackColor = Me.BackColor
End Sub

Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.BackColor = vbCyan
Command2.BackColor = Me.BackColor
Command3.BackColor = Me.BackColor
End Sub

Private Sub Command2_Click()
Screen.MousePointer = vbHourglass
retvalue = mciSendString("set CDAudio door closed", returnstring, 127, 0)
Screen.MousePointer = vbNormal
End Sub

Private Sub Command2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command2.BackColor = vbCyan
Command1.BackColor = Me.BackColor
Command3.BackColor = Me.BackColor
End Sub

Private Sub Command3_Click()
Load myname
myname.Show
End Sub

Private Sub Command3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command3.BackColor = vbCyan
Command1.BackColor = Me.BackColor
Command2.BackColor = Me.BackColor
End Sub

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyCode = vbkeyesc Then Unload Me
End Sub

Private Sub Form_Load()
    Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2 'Center the form
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Command1.BackColor = Me.BackColor
Command2.BackColor = Me.BackColor
Command3.BackColor = Me.BackColor
End Sub

Project Homepage: