using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;

namespace ExitWindowsEx_CS
{
    public partial class Form1 : Form
    {
        [DllImport("aygshell.dll")]
        public static extern Boolean ExitWindowsEx
        (int uFlags, int dwReserved);

        const int EWX_REBOOT = 2; // перезагрузка

        public Form1()
        {
            InitializeComponent();
            #if DEBUG
                MinimizeBox = false;
            #else       
                MinimizeBox = true;
            #endif
        }

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