C # control the computer's standby shutdown, logout, restart, and other operations

Source: Internet
Author: User
Document directory
  • Parameters

System APIs must be called to control computers.

 

Method To Call The system API:

1: using system. runtime. interopservices;

2: Introduce the DLL in the format of [dllimport ("USER32")]

3: API declaration, in the format of internal static extern bool exitwindowsex (INT flg, int rea );

 

There are many ways to perform operations such as shutdown, logout, and restart.

Http://blog.csdn.net/ylqmf/archive/2010/01/04/5128330.aspx

 

However, the standby mode is not common.

Use the power management API

Bool winapi setsystempowerstate (
_ In boolFsuspend,
_ In boolFforce
);

Parameters Fsuspend[In]

The parameter is ture system suspension (suspend); the parameter is false, and the system disk is in standby mode (hibernate)

Suspend indicates that the current system parameter is saved to the memory, and the CPU power is still on.

Hibernate is saved to the hard disk, CPU power off

Therefore, the standby and wake-up modes of suspend are faster than those of hibernate.

Fforce[In]

Invalid

 

For more information, see http://msdn.microsoft.com/en-us/library/aa373206 (vs.85). aspx

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.