'***************************************************
'
' This program shuts down your PC after 5 minutes
' of switching on if kept in start of windows
'
' Programmed by Deepak Mehtani
' Mail me at : [email protected]
'
'***************************************************'********************************'
'Double Click time to enable exit'
'********************************'Private Const EWX_SHUTDOWN As Long = 1
Private Declare Function ExitWindowsEx Lib "user32" (ByVal dwOptions As Long, ByVal dwReserved As Long) As LongDim Hrs
Dim Mnt
Dim AMPM
Dim SetAlarmPrivate Sub cmdCurrent_Click()
MsgBox SetAlarm, , "Current Alarm Time"
End SubPrivate Sub cmdQuit_Click()
End
End SubPrivate Sub cmdSet_Click()
Dim h, m, nh, nm
h = Hour(Time)
If h > 12 Then
h = h - 12
optPM.Value = True
Else
optAM.Value = True
End If
m = Minute(Time)
nm = m + 5
If nm > 59 Then
nm = nm - 59
nh = h + 1
If nh > 12 And AMPM = "AM" Then
nh = nh - 12
AMPM = "PM"
ElseIf nh > 12 And AMPM = "PM" Then
nh = nh - 12
AMPM = "AM"
End If
Else
nh = h
End If
txtHours.Text = nh
If nm > 10 Then
txtMinutes.Text = nm
Else
txtMinutes.Text = "0" & nm
End If
Hrs = txtHours.Text
Mnt = txtMinutes.Text
If optAM.Value = True Then
AMPM = "AM"
ElseIf optPM.Value = True Then
AMPM = "PM"
End If SetAlarm = Hrs + ":" + Mnt + ":00 " + AMPM
End SubPrivate Sub Form_Load()
Me.Top = (Screen.Height - Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2
Call cmdSet_Click
End SubPrivate Sub lblTime_DblClick()
cmdQuit.Enabled = True
End SubPrivate Sub Timer1_Timer()
lblTime.Caption = Time ' Update time display.
If SetAlarm = lblTime.Caption Then
'shut down the computer
lngResult = ExitWindowsEx(EWX_SHUTDOWN, 0&)
End If
End Sub
'
' This program shuts down your PC after 5 minutes
' of switching on if kept in start of windows
'
' Programmed by Deepak Mehtani
' Mail me at : [email protected]
'
'***************************************************'********************************'
'Double Click time to enable exit'
'********************************'Private Const EWX_SHUTDOWN As Long = 1
Private Declare Function ExitWindowsEx Lib "user32" (ByVal dwOptions As Long, ByVal dwReserved As Long) As LongDim Hrs
Dim Mnt
Dim AMPM
Dim SetAlarmPrivate Sub cmdCurrent_Click()
MsgBox SetAlarm, , "Current Alarm Time"
End SubPrivate Sub cmdQuit_Click()
End
End SubPrivate Sub cmdSet_Click()
Dim h, m, nh, nm
h = Hour(Time)
If h > 12 Then
h = h - 12
optPM.Value = True
Else
optAM.Value = True
End If
m = Minute(Time)
nm = m + 5
If nm > 59 Then
nm = nm - 59
nh = h + 1
If nh > 12 And AMPM = "AM" Then
nh = nh - 12
AMPM = "PM"
ElseIf nh > 12 And AMPM = "PM" Then
nh = nh - 12
AMPM = "AM"
End If
Else
nh = h
End If
txtHours.Text = nh
If nm > 10 Then
txtMinutes.Text = nm
Else
txtMinutes.Text = "0" & nm
End If
Hrs = txtHours.Text
Mnt = txtMinutes.Text
If optAM.Value = True Then
AMPM = "AM"
ElseIf optPM.Value = True Then
AMPM = "PM"
End If SetAlarm = Hrs + ":" + Mnt + ":00 " + AMPM
End SubPrivate Sub Form_Load()
Me.Top = (Screen.Height - Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2
Call cmdSet_Click
End SubPrivate Sub lblTime_DblClick()
cmdQuit.Enabled = True
End SubPrivate Sub Timer1_Timer()
lblTime.Caption = Time ' Update time display.
If SetAlarm = lblTime.Caption Then
'shut down the computer
lngResult = ExitWindowsEx(EWX_SHUTDOWN, 0&)
End If
End Sub
解决方案 »
- 我真一根筋啊 怎么就是不想放弃啊
- 请教调用存储过程
- 给我孩子求个名字
- 请问如何使2个表里的数据同步,高手指教~
- 如何在截屏后清空内存中刚才截的图片???
- filesystemobject的问题,请关注!!!!!
- 调用我vb编写的com组件的时候提示run-time error '5':无效的过程调用或参数,请问时哪里错误
- 急求解决方法,各位高手!在线等!
- 在程序退出时拷备数据库(备份)的方法
- 大家都来讨论,我该放弃vb该学其他还是继续学习vb?
- 我自己编了一个MP3播放器,也修改注册表使MP3与之相联,但双击MP3时只能启动播放器,不能播放,要在哪里加入代码?
- 麻烦问一下大家,有谁知道怎么能够在VB中通过编码打开一个用Delphi写的exe文件
用shell调用一个命令就行了.
shell "rundll.exe user.exe,exitwindows"