Private Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Long
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 Const EWX_LOGOFF = 0
Private Const EWX_REBOOT = 2
Private Const EWX_SHUTDOWN = 1
Private Const EWX_FORCE = 4
Private Sub cmdShutDown_Click()
Dim lngShutDown As Long, intConfirm As Integer
intConfirm = MsgBox("Shut down computer?", vbOKCancel)
If intConfirm = vbOK Then lngShutDown = ExitWindowsEx(EWX_SHUTDOWN, 0&)
End Sub
Private Sub cmdOpen_Click()
Call mciSendString("Set CDAudio Door Open Wait", 0&, 0&, 0&)
End Sub
Private Sub cmdClose_Click()
Call mciSendString("Set CDAudio Door Closed Wait", 0&, 0&, 0&)
End Sub |