当前位置:编程学习 > VB >>

求XP下待机(休眠)VB代码,要简单点的

在网上搜到Shell "shutdown -H,但是不能用,后来查得在2003以上可以用,但在XP下不能用
又搜到SetSuspendState False, False, False,但也不能用,再后来搜到Shell "Rundll32.exe PowrProf.dll, SetSuspendState",可以实现待机,但唤醒必须用主机的开关机键,键盘和鼠标上的所有键均不能唤醒,再求高手给个简单点的,代码要简单点,并且用键盘能够唤醒的代码 --------------------编程问答-------------------- 结帖率:0.00%  --------------------编程问答-------------------- psshutdown.exe
http://technet.microsoft.com/en-us/sysinternals/bb545027.aspx --------------------编程问答--------------------
引用 1 楼 dbcontrols 的回复:
结帖率:0.00%
结帖率:0.00%
该用户混论坛应该还没多久呢,先观察一段时间再说。

试试楼上的psshutdown.exe --------------------编程问答--------------------
引用 3 楼 sysdzw 的回复:
引用 1 楼 dbcontrols 的回复:

结帖率:0.00%
结帖率:0.00%
该用户混论坛应该还没多久呢,先观察一段时间再说。

试试楼上的psshutdown.exe

我混论坛的时间不短了,但在本论坛还是新手,帖子也不多 --------------------编程问答--------------------
引用 2 楼 zhao4zhong1 的回复:
psshutdown.exe
http://technet.microsoft.com/en-us/sysinternals/bb545027.aspx

谢谢兄弟的帮助,非常感谢,我先试试 --------------------编程问答--------------------
引用 2 楼 zhao4zhong1 的回复:
psshutdown.exe
http://technet.microsoft.com/en-us/sysinternals/bb545027.aspx

怎么不管用呀,弹出一个窗口,也不执行待机 --------------------编程问答-------------------- 非技术类 帖子就该闲聊,呵呵 --------------------编程问答-------------------- 休眠的话应该就是按电源开关才唤醒的.
键盘唤醒的那不是休眠而是待机 --------------------编程问答--------------------
引用 8 楼 wallescai 的回复:
休眠的话应该就是按电源开关才唤醒的.
键盘唤醒的那不是休眠而是待机

原来是这样,还以为二者是一样的呢

二者的区别:

休眠——计算机在关闭前首先将内存中的信息存入硬盘的一种状态。将计算机从休眠中唤醒时,所有打开的应用程序和文档都会恢复到桌面上。

待机——计算机在闲置时处于低功耗状态,但仍能保持立即使用。计算机在待机状态时,内存中的信息未存入硬盘中。如此时电源中断,内存中的信息会丢失。

待机是指仅对内存等主要设备供电,保存当前状态,以达到降低功耗的目的,适合短时间不用。

休眠是指把当前内存的数据保存到c:\hiberfil.sys文件里面,电脑完全停止工作(相当于关机),下次启动就直接从hiberfil.sys文件里面读取数据,恢复休眠前的状态。
--------------------编程问答-------------------- 继续求解XP下待机(简单点)的VB代码 --------------------编程问答-------------------- PsShutdown
PsShutdown is a similar to the Resource Kit and Windows XP shutdown tools, providing you the same options and ability to shutdown, and optionally reboot, local and remote Windows NT/2K/XP/2003 systems. It also provided additional options that make it more powerful and flexible.

Installation
 
Copy PsShutdown onto your executable path and type "psshutdown" with command-line options defined below.

Usage
 
You can use PsShutdown to initiate a shutdown of the local or a remote computer, abort an imminent shutdown, logoff a console user, or lock the desktop.

usage: psshutdown [\\computer[,computer[,...] | @file [-u username [-p password]]]  -s|-r|-h|-d|-k|-a|-l|-o [-f] [-c] [-n s] [-t nn|h:m]  [-e [u|p]:xx:yy] [-m "message"] 

 
 computer
 Run the command on the computer or computers specified. If you omit the computer name the command runs on the local system and if you enter a computer name of \\* then the command runs on all computers in the current domain.
 
 
 @file
 Execute the command on each of the computers listed in the file.
 
 
 -u
 Specifies optional user name for login to remote computer
 
 
 -p
 Specifies optional password for user name. If you omit this you will be prompted to enter a hidden password.
 
 
 -a
 Aborts a shutdown (only possible while a countdown is in progress)
 
 
 -c
 Allow the shutdown to be aborted by the interactive user
 
 
 -e
 Shutdown reason code. Specify 'u' for user reason codes and 'p' for planned shutdown reason codes.
xx is the major reason code (must be less than 256)
yy is the minor reason code (must be less than 65536)
 
 
 -f
 Forces all running applications to exit during the shutdown instead of giving them a chance to gracefully save their data
 
 
 -h
 Hibernate the computer
 
 
 -k
 Poweroff the computer (reboot if poweroff is not supported
 
 
 -l 
 Lock the computer
 
 
 -m 
 This option lets you specify a message to display to logged-on users when a shutdown countdown commences
 
 
 -n
 Specifies timeout in seconds connecting to remote computers
 
 
 -o
 Logoff the console user
 
 
 -r
 Reboot after shutdown
 
 
 -s
 Shutdown without poweroff
 
 
 -t
 Specifies the countdown in seconds until the shutdown (default: 20 seconds) or the time of shutdown in 24 hour notation
 
 
 -v
 Display message for the specified number of seconds before the shutdown. If you omit this parameter the shutdown notification dialog displays and specifying a value of 0 omits the dialog.
 
--------------------编程问答-------------------- shell "psshutdown -h"
'第一次执行会弹出对话框,选ACC
补充:VB ,  非技术类
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,