用vfp表单做个计时关机程序
下面就是定时关机程序,输入多少秒钟后关机(1小时就是3600秒),到时就关闭电脑。若中途不想关机了,还可以随时取消。
1、“定时关机”命令按钮代码:
IF thisform.command1.Caption="定时关机"
搏瞎差 thisform.text1.Visible= .T.
thisform.command2.Visible= .T.
thisform.command2.Caption="确定"
thisform.command2.BackColor=RGB(255,225,0)
thisform.command2.ForeColor=RGB(225,0,128)
endif
IF thisform.command1.Caption="取消关机"
RUN c:\windows\system32\shutdown.exe -a
thisform.command2.Caption="退出"
thisform.command2.BackColor=RGB(255,255,0)
thisform.command2.ForeColor=RGB(255,0,128)
thisform.text1.Visible= .F.
thisform.command2.Visible= .T.
ENDIF
IF thisform.command1.Caption="退出"
QUIT
ENDIF
IF thisform.command1.Caption="定时关机"
基皮 thisform.command1.Caption="退出"
thisform.command1.BackColor=RGB(255,255,0)
thisform.command1.ForeColor=RGB(255,0,128)
ENDIF
IF thisform.command1.Caption="取消关机"
thisform.command1.Caption="定时关机"
thisform.command1.BackColor=RGB(0,255,255)
神旁thisform.command1.BackColor=RGB(0,128,255)
thisform.text1.Visible= .T.
ENDIF
2、“确定”命令按钮代码:
IF thisform.command2.Caption="确定"
t=thisform.text1.value
RUN c:\windows\system32\shutdown.exe -s -t &t
thisform.command1.Caption="取消关机"
thisform.command1.BackColor=RGB(255,128,255)
thisform.command1.ForeColor=RGB(0,0,160)
thisform.text1.Visible= .F.
thisform.command1.Visible= .T.
ENDIF
IF thisform.command2.Caption="退出"
QUIT
ENDIF
thisform.command2.Caption="退出"