vb:如何一键更改屏保的等待时间

来源:百度知道 编辑:UC知道 时间:2024/05/16 16:03:25
我经常外出,但是又不想关机,于是走之前就设置屏保的等待时间为1分钟,回来后又要设回30钟,请问有没有哪个高手可以给我代码,我只需要2个按钮,一个是设置屏保的等待时间为1分钟,另一个按钮是设置为30分钟,谢谢!

笨方法呵..

新建工程,放2个按钮.全部代码如下:

Private Sub Command1_Click() '设置为30分钟
Shell "control desk.cpl", 1 '打开显示属性
SendKeys "+{TAB}", True '切换到屏保页
SendKeys "{RIGHT}", True
SendKeys "{RIGHT}", True
SendKeys "{TAB}", True '切换到屏保时间
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys 3, True '输入30并回车
SendKeys 0, True
SendKeys "~", True
End Sub

Private Sub Command2_Click() '设置为1分钟
Shell "control desk.cpl", 1 '打开显示属性
SendKeys "+{TAB}", True '切换到屏保页
SendKeys "{RIGHT}", True
SendKeys "{RIGHT}", True
SendKeys "{TAB}", True '切换到屏保时间
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys "{TAB}", True
SendKeys 1, True '输入1并回车
SendKeys