Showing posts with label shutdoen the system. Show all posts
Showing posts with label shutdoen the system. Show all posts

Monday, May 31, 2021

【Visual Studio Visual Csharp】OS function logoff,restart,shutdoen the system

 using System;

using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Runtime.InteropServices; // make sure that using System.Runtime.InteropServices; is included using System.Diagnostics; // make sure that using System.Diagnostics; is included namespace osfunctionC { public partial class Form1 : Form { public Form1() { InitializeComponent(); } [DllImport("user32.dll")] public static extern int ExitWindowsEx(int operationFlag, int operationReason); private void button1_Click(object sender, EventArgs e) { // Log off the System ExitWindowsEx(0, 0); } private void button2_Click(object sender, EventArgs e) { // Restart the System ExitWindowsEx(2, 0); } private void button3_Click(object sender, EventArgs e) { // Shut Down the System ExitWindowsEx(1, 0); } } }

Jumping the curve

Why the boldest founders don’t just ride the S-curve—they leap to the next one before everyone else sees the drop coming. ͏     ­͏     ­͏   ...