Wednesday, 12 July 2017

A small C# application for Windows Lock, logOff, Restart and Shutdown.

Hi, Everyone!

                     Users can use different ways to shutdown their Computer Systems like Shutdown.
Today I will show some shortcut coding techniques to Windows Lock, Log off, Restart and Shutdown.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Bunifu.Framework;
using Bunifu.Framework.UI;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Management;

namespace Power
{
    public partial class Form1 : Form
    {
        [DllImport("user32")]
        public static extern void LockWorkStation();
        [DllImport("user32")]
        public static extern bool ExitWindowsEx(uint uFlags, uint dwReason);

        public Form1()
        {
            InitializeComponent();
        }

        private void btnLock_Click(object sender, EventArgs e)
        {
            LockWorkStation();
        }

        private void btnLogOff_Click(object sender, EventArgs e)
        {
            ExitWindowsEx(0, 0);            
        }

        private void btnRestart_Click(object sender, EventArgs e)
        {
            Process.Start("shutdown", "/r /t 0");
        }

        private void btnShutdown_Click(object sender, EventArgs e)
        {
            Process.Start("shutdown", "/s /t 0");
        }




Thank you!

                                                                                                                          Santosh Kokatnur

Hi, Everyone!

                   This is Santosh K Kokatnur.

I have been working as Sr.Software Engineer in ShifttoCloud Software India Private Ltd.


I am a hands-on Software Developer, I have developed console, database, and Desktop applications using current versions of Microsoft Visual Studio (Frameworks: 1.1, 2.0, 3.5, 4.0, 4.5).

As a highly motivated computer professional with the enthusiasm to accept new challenge, With a proven record of achievement in positions of similar scope and responsibility.