Author Topic: Shutdown function in C++ visual 2010  (Read 16234 times)

0 Members and 1 Guest are viewing this topic.

Offline daantje

  • ZX 81
  • *
  • Posts: 9
  • Karma: 0
    • View Profile
Shutdown function in C++ visual 2010
« on: January 25, 2012 »
Hi,

I wanted to make a shutdown, in windows 7, I use microsoft visual c++ 2010 express , a form application.
I made a function in the form that should shutdown the pc but even though it does compile ( some functions), it never shuts the pc down.
The functions i found (but didn't work):
Shell(..);
ExitWindowsex();
system("shutdown");
None of these work. I think the problem lies in the fact I use windows 7 and that the functions are made for vista or xp. Otherwise the problem might be in my code but I don't see why.

Any help appreciated,

Daan

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: Shutdown function in C++ visual 2010
« Reply #1 on: January 25, 2012 »
Should all be fine on Windows 7.

The command line for shutdown is
shutdown -t 1 -f -s

That will force a shutdown after 1 second.
Just running shutdown doesn't do anything - it only shows the usage.

ExitWindowsEx should also work.
ExitWindowsEx(EWX_POWEROFF|EWX_FORCE, 0);

Take care using -f or EWX_FORCE as that can cause applications to lose data.  Using it means that other applications are not given the chance to save their data but it means they cannot cancel the shutdown.

Jim
« Last Edit: January 25, 2012 by Jim »
Challenge Trophies Won:

Offline daantje

  • ZX 81
  • *
  • Posts: 9
  • Karma: 0
    • View Profile
Re: Shutdown function in C++ visual 2010
« Reply #2 on: January 26, 2012 »
Thanks for replying, but it still doesn't work, it gives an error.

Do i need to include something else? I already have: #include <windows.h>, #include <iostream>

Or is the mistake in the code, this is the part where it is used:
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
                         checkBox4-> Visible = true;
          checkBox5-> Visible = true;
          progressBar1-> Visible = true;
          this-> timer1-> Start ();   
          ExitWindowsEx(EWX_POWEROFF,0);
                         }

Offline daantje

  • ZX 81
  • *
  • Posts: 9
  • Karma: 0
    • View Profile
Re: Shutdown function in C++ visual 2010
« Reply #3 on: January 26, 2012 »
Code: [Select]
#pragma once
#include <windows.h>
#include <iostream>
using namespace std;
namespace Hello {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}

protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::ProgressBar^  progressBar1;
private: System::Windows::Forms::CheckBox^  checkBox1;
private: System::Windows::Forms::Label^  label1;
private: System::Windows::Forms::CheckBox^  checkBox2;
private: System::Windows::Forms::Label^  label2;
private: System::Windows::Forms::LinkLabel^  linkLabel1;
private: System::Windows::Forms::CheckBox^  checkBox3;
private: System::Windows::Forms::CheckBox^  checkBox4;
private: System::Windows::Forms::CheckBox^  checkBox5;
private: System::Windows::Forms::Label^  label3;
private: System::Windows::Forms::Label^  label4;
private: System::Windows::Forms::Label^  label5;
private: System::Windows::Forms::Button^  button1;
private: System::Windows::Forms::Button^  button2;
private: System::Windows::Forms::Label^  label6;
private: System::Windows::Forms::Timer^  timer1;
private: System::ComponentModel::IContainer^  components;
protected:

private:
/// <summary>
/// Required designer variable.
/// </summary>


#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->components = (gcnew System::ComponentModel::Container());
this->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->checkBox2 = (gcnew System::Windows::Forms::CheckBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->linkLabel1 = (gcnew System::Windows::Forms::LinkLabel());
this->checkBox3 = (gcnew System::Windows::Forms::CheckBox());
this->checkBox4 = (gcnew System::Windows::Forms::CheckBox());
this->checkBox5 = (gcnew System::Windows::Forms::CheckBox());
this->label3 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->label5 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->label6 = (gcnew System::Windows::Forms::Label());
this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
this->SuspendLayout();
//
// progressBar1
//
this->progressBar1->ForeColor = System::Drawing::Color::Lime;
this->progressBar1->Location = System::Drawing::Point(12, 204);
this->progressBar1->Name = L"progressBar1";
this->progressBar1->Size = System::Drawing::Size(307, 23);
this->progressBar1->Step = 3;
this->progressBar1->Style = System::Windows::Forms::ProgressBarStyle::Continuous;
this->progressBar1->TabIndex = 0;
this->progressBar1->Visible = false;
//
// checkBox1
//
this->checkBox1->AutoSize = true;
this->checkBox1->Checked = true;
this->checkBox1->CheckState = System::Windows::Forms::CheckState::Checked;
this->checkBox1->Enabled = false;
this->checkBox1->Location = System::Drawing::Point(37, 115);
this->checkBox1->Name = L"checkBox1";
this->checkBox1->Size = System::Drawing::Size(15, 14);
this->checkBox1->TabIndex = 1;
this->checkBox1->UseVisualStyleBackColor = true;
this->checkBox1->Visible = false;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(90, 115);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(113, 13);
this->label1->TabIndex = 2;
this->label1->Text = L"Delete all files, except:\r\n";
this->label1->Visible = false;
//
// checkBox2
//
this->checkBox2->AutoSize = true;
this->checkBox2->Cursor = System::Windows::Forms::Cursors::No;
this->checkBox2->Enabled = false;
this->checkBox2->Location = System::Drawing::Point(37, 174);
this->checkBox2->Name = L"checkBox2";
this->checkBox2->Size = System::Drawing::Size(15, 14);
this->checkBox2->TabIndex = 3;
this->checkBox2->UseVisualStyleBackColor = true;
this->checkBox2->Visible = false;
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(90, 175);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(182, 13);
this->label2->TabIndex = 4;
this->label2->Text = L"Make a backup of the System32 files";
this->label2->Visible = false;
//
// linkLabel1
//
this->linkLabel1->AutoSize = true;
this->linkLabel1->Location = System::Drawing::Point(34, 253);
this->linkLabel1->Name = L"linkLabel1";
this->linkLabel1->Size = System::Drawing::Size(249, 13);
this->linkLabel1->TabIndex = 5;
this->linkLabel1->TabStop = true;
this->linkLabel1->Text = L"Having trouble using this program\? Ask our experts!";
this->linkLabel1->LinkClicked += gcnew System::Windows::Forms::LinkLabelLinkClickedEventHandler(this, &Form1::linkLabel1_LinkClicked);
//
// checkBox3
//
this->checkBox3->AutoSize = true;
this->checkBox3->Location = System::Drawing::Point(210, 94);
this->checkBox3->Name = L"checkBox3";
this->checkBox3->Size = System::Drawing::Size(15, 14);
this->checkBox3->TabIndex = 6;
this->checkBox3->UseVisualStyleBackColor = true;
this->checkBox3->Visible = false;
//
// checkBox4
//
this->checkBox4->AutoSize = true;
this->checkBox4->Cursor = System::Windows::Forms::Cursors::No;
this->checkBox4->Enabled = false;
this->checkBox4->Location = System::Drawing::Point(210, 115);
this->checkBox4->Name = L"checkBox4";
this->checkBox4->Size = System::Drawing::Size(15, 14);
this->checkBox4->TabIndex = 7;
this->checkBox4->UseVisualStyleBackColor = true;
this->checkBox4->Visible = false;
//
// checkBox5
//
this->checkBox5->AutoSize = true;
this->checkBox5->Location = System::Drawing::Point(210, 135);
this->checkBox5->Name = L"checkBox5";
this->checkBox5->Size = System::Drawing::Size(15, 14);
this->checkBox5->TabIndex = 8;
this->checkBox5->UseVisualStyleBackColor = true;
this->checkBox5->Visible = false;
//
// label3
//
this->label3->AutoSize = true;
this->label3->Location = System::Drawing::Point(232, 94);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(40, 13);
this->label3->TabIndex = 9;
this->label3->Text = L"Photos";
this->label3->Visible = false;
//
// label4
//
this->label4->AutoSize = true;
this->label4->Location = System::Drawing::Point(232, 115);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(61, 13);
this->label4->TabIndex = 10;
this->label4->Text = L"Documents";
this->label4->Visible = false;
//
// label5
//
this->label5->AutoSize = true;
this->label5->Location = System::Drawing::Point(235, 135);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(49, 13);
this->label5->TabIndex = 11;
this->label5->Text = L"Contacts";
this->label5->Visible = false;
//
// button1
//
this->button1->Location = System::Drawing::Point(197, 45);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 12;
this->button1->Text = L"Exit";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(37, 45);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(104, 23);
this->button2->TabIndex = 13;
this->button2->Text = L"Mystery Button";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// label6
//
this->label6->AutoSize = true;
this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label6->Location = System::Drawing::Point(52, 9);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(211, 24);
this->label6->TabIndex = 14;
this->label6->Text = L"Deleting all of your files..\r\n";
this->label6->Visible = false;
//
// timer1
//
this->timer1->Enabled = true;
this->timer1->Interval = 300;
this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(331, 306);
this->Controls->Add(this->label6);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->label5);
this->Controls->Add(this->label4);
this->Controls->Add(this->label3);
this->Controls->Add(this->checkBox5);
this->Controls->Add(this->checkBox4);
this->Controls->Add(this->checkBox3);
this->Controls->Add(this->linkLabel1);
this->Controls->Add(this->label2);
this->Controls->Add(this->checkBox2);
this->Controls->Add(this->label1);
this->Controls->Add(this->checkBox1);
this->Controls->Add(this->progressBar1);
this->Name = L"Form1";
this->Text = L"Change your pc!";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();

}
#pragma endregion
private: System::Void linkLabel1_LinkClicked(System::Object^  sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^  e) {

}
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
Application::Exit();
}
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
button1-> Visible = false;
button2-> Visible = false;
label1-> Visible = true;
label2-> Visible = true;
label3-> Visible = true;
label4-> Visible = true;
label5-> Visible = true;
label6-> Visible = true;
checkBox1-> Visible = true;
checkBox2-> Visible = true;
checkBox3-> Visible = true;
checkBox4-> Visible = true;
checkBox5-> Visible = true;
progressBar1-> Visible = true;
ExitWindowsEx(EWX_POWEROFF,0);
this-> timer1-> Start ();


}
private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
this->progressBar1-> Increment(1);
if (progressBar1->Value == progressBar1->Maximum) {
label6-> Text = "Program Finished";
}
}
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
}
};
}


Offline daantje

  • ZX 81
  • *
  • Posts: 9
  • Karma: 0
    • View Profile
Re: Shutdown function in C++ visual 2010
« Reply #4 on: January 26, 2012 »
Problem solved, this is the program, it's a form that says it's deleting all your files but doesnt (ofcourse) and then shuts down the pc, my first form application! Use it on own risk though , and save your files before running the program, it shuts down after 40 secs.
Code: [Select]
#pragma once
#include <windows.h>
#include <iostream>
using namespace std;
namespace Hello {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary>
/// Summary for Form1
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}

protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}
private: System::Windows::Forms::ProgressBar^  progressBar1;
private: System::Windows::Forms::CheckBox^  checkBox1;
private: System::Windows::Forms::Label^  label1;
private: System::Windows::Forms::CheckBox^  checkBox2;
private: System::Windows::Forms::Label^  label2;
private: System::Windows::Forms::LinkLabel^  linkLabel1;
private: System::Windows::Forms::CheckBox^  checkBox3;
private: System::Windows::Forms::CheckBox^  checkBox4;
private: System::Windows::Forms::CheckBox^  checkBox5;
private: System::Windows::Forms::Label^  label3;
private: System::Windows::Forms::Label^  label4;
private: System::Windows::Forms::Label^  label5;
private: System::Windows::Forms::Button^  button1;
private: System::Windows::Forms::Button^  button2;
private: System::Windows::Forms::Label^  label6;
private: System::Windows::Forms::Timer^  timer1;
private: System::ComponentModel::IContainer^  components;
protected:

private:
/// <summary>
/// Required designer variable.
/// </summary>


#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->components = (gcnew System::ComponentModel::Container());
this->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
this->label1 = (gcnew System::Windows::Forms::Label());
this->checkBox2 = (gcnew System::Windows::Forms::CheckBox());
this->label2 = (gcnew System::Windows::Forms::Label());
this->linkLabel1 = (gcnew System::Windows::Forms::LinkLabel());
this->checkBox3 = (gcnew System::Windows::Forms::CheckBox());
this->checkBox4 = (gcnew System::Windows::Forms::CheckBox());
this->checkBox5 = (gcnew System::Windows::Forms::CheckBox());
this->label3 = (gcnew System::Windows::Forms::Label());
this->label4 = (gcnew System::Windows::Forms::Label());
this->label5 = (gcnew System::Windows::Forms::Label());
this->button1 = (gcnew System::Windows::Forms::Button());
this->button2 = (gcnew System::Windows::Forms::Button());
this->label6 = (gcnew System::Windows::Forms::Label());
this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
this->SuspendLayout();
//
// progressBar1
//
this->progressBar1->ForeColor = System::Drawing::Color::Lime;
this->progressBar1->Location = System::Drawing::Point(12, 204);
this->progressBar1->Name = L"progressBar1";
this->progressBar1->Size = System::Drawing::Size(307, 23);
this->progressBar1->Step = 3;
this->progressBar1->Style = System::Windows::Forms::ProgressBarStyle::Continuous;
this->progressBar1->TabIndex = 0;
this->progressBar1->Visible = false;
//
// checkBox1
//
this->checkBox1->AutoSize = true;
this->checkBox1->Checked = true;
this->checkBox1->CheckState = System::Windows::Forms::CheckState::Checked;
this->checkBox1->Enabled = false;
this->checkBox1->Location = System::Drawing::Point(37, 115);
this->checkBox1->Name = L"checkBox1";
this->checkBox1->Size = System::Drawing::Size(15, 14);
this->checkBox1->TabIndex = 1;
this->checkBox1->UseVisualStyleBackColor = true;
this->checkBox1->Visible = false;
//
// label1
//
this->label1->AutoSize = true;
this->label1->Location = System::Drawing::Point(90, 115);
this->label1->Name = L"label1";
this->label1->Size = System::Drawing::Size(113, 13);
this->label1->TabIndex = 2;
this->label1->Text = L"Delete all files, except:\r\n";
this->label1->Visible = false;
//
// checkBox2
//
this->checkBox2->AutoSize = true;
this->checkBox2->Cursor = System::Windows::Forms::Cursors::No;
this->checkBox2->Enabled = false;
this->checkBox2->Location = System::Drawing::Point(37, 174);
this->checkBox2->Name = L"checkBox2";
this->checkBox2->Size = System::Drawing::Size(15, 14);
this->checkBox2->TabIndex = 3;
this->checkBox2->UseVisualStyleBackColor = true;
this->checkBox2->Visible = false;
//
// label2
//
this->label2->AutoSize = true;
this->label2->Location = System::Drawing::Point(90, 175);
this->label2->Name = L"label2";
this->label2->Size = System::Drawing::Size(182, 13);
this->label2->TabIndex = 4;
this->label2->Text = L"Make a backup of the System32 files";
this->label2->Visible = false;
//
// linkLabel1
//
this->linkLabel1->AutoSize = true;
this->linkLabel1->Location = System::Drawing::Point(34, 253);
this->linkLabel1->Name = L"linkLabel1";
this->linkLabel1->Size = System::Drawing::Size(249, 13);
this->linkLabel1->TabIndex = 5;
this->linkLabel1->TabStop = true;
this->linkLabel1->Text = L"Having trouble using this program\? Ask our experts!";
this->linkLabel1->LinkClicked += gcnew System::Windows::Forms::LinkLabelLinkClickedEventHandler(this, &Form1::linkLabel1_LinkClicked);
//
// checkBox3
//
this->checkBox3->AutoSize = true;
this->checkBox3->Location = System::Drawing::Point(210, 94);
this->checkBox3->Name = L"checkBox3";
this->checkBox3->Size = System::Drawing::Size(15, 14);
this->checkBox3->TabIndex = 6;
this->checkBox3->UseVisualStyleBackColor = true;
this->checkBox3->Visible = false;
//
// checkBox4
//
this->checkBox4->AutoSize = true;
this->checkBox4->Cursor = System::Windows::Forms::Cursors::No;
this->checkBox4->Enabled = false;
this->checkBox4->Location = System::Drawing::Point(210, 115);
this->checkBox4->Name = L"checkBox4";
this->checkBox4->Size = System::Drawing::Size(15, 14);
this->checkBox4->TabIndex = 7;
this->checkBox4->UseVisualStyleBackColor = true;
this->checkBox4->Visible = false;
//
// checkBox5
//
this->checkBox5->AutoSize = true;
this->checkBox5->Location = System::Drawing::Point(210, 135);
this->checkBox5->Name = L"checkBox5";
this->checkBox5->Size = System::Drawing::Size(15, 14);
this->checkBox5->TabIndex = 8;
this->checkBox5->UseVisualStyleBackColor = true;
this->checkBox5->Visible = false;
//
// label3
//
this->label3->AutoSize = true;
this->label3->Location = System::Drawing::Point(232, 94);
this->label3->Name = L"label3";
this->label3->Size = System::Drawing::Size(40, 13);
this->label3->TabIndex = 9;
this->label3->Text = L"Photos";
this->label3->Visible = false;
//
// label4
//
this->label4->AutoSize = true;
this->label4->Location = System::Drawing::Point(232, 115);
this->label4->Name = L"label4";
this->label4->Size = System::Drawing::Size(61, 13);
this->label4->TabIndex = 10;
this->label4->Text = L"Documents";
this->label4->Visible = false;
//
// label5
//
this->label5->AutoSize = true;
this->label5->Location = System::Drawing::Point(235, 135);
this->label5->Name = L"label5";
this->label5->Size = System::Drawing::Size(49, 13);
this->label5->TabIndex = 11;
this->label5->Text = L"Contacts";
this->label5->Visible = false;
//
// button1
//
this->button1->Location = System::Drawing::Point(197, 45);
this->button1->Name = L"button1";
this->button1->Size = System::Drawing::Size(75, 23);
this->button1->TabIndex = 12;
this->button1->Text = L"Exit";
this->button1->UseVisualStyleBackColor = true;
this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
//
// button2
//
this->button2->Location = System::Drawing::Point(37, 45);
this->button2->Name = L"button2";
this->button2->Size = System::Drawing::Size(104, 23);
this->button2->TabIndex = 13;
this->button2->Text = L"Mystery Button";
this->button2->UseVisualStyleBackColor = true;
this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
//
// label6
//
this->label6->AutoSize = true;
this->label6->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 14.25F, System::Drawing::FontStyle::Regular, System::Drawing::GraphicsUnit::Point,
static_cast<System::Byte>(0)));
this->label6->Location = System::Drawing::Point(52, 9);
this->label6->Name = L"label6";
this->label6->Size = System::Drawing::Size(211, 24);
this->label6->TabIndex = 14;
this->label6->Text = L"Deleting all of your files..\r\n";
this->label6->Visible = false;
//
// timer1
//
this->timer1->Enabled = true;
this->timer1->Interval = 300;
this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(331, 306);
this->Controls->Add(this->label6);
this->Controls->Add(this->button2);
this->Controls->Add(this->button1);
this->Controls->Add(this->label5);
this->Controls->Add(this->label4);
this->Controls->Add(this->label3);
this->Controls->Add(this->checkBox5);
this->Controls->Add(this->checkBox4);
this->Controls->Add(this->checkBox3);
this->Controls->Add(this->linkLabel1);
this->Controls->Add(this->label2);
this->Controls->Add(this->checkBox2);
this->Controls->Add(this->label1);
this->Controls->Add(this->checkBox1);
this->Controls->Add(this->progressBar1);
this->Name = L"Form1";
this->Text = L"Change your pc!";
this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
this->ResumeLayout(false);
this->PerformLayout();

}
#pragma endregion
private: System::Void linkLabel1_LinkClicked(System::Object^  sender, System::Windows::Forms::LinkLabelLinkClickedEventArgs^  e) {

}
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
Application::Exit();
}
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {
button1-> Visible = false;
button2-> Visible = false;
label1-> Visible = true;
label2-> Visible = true;
label3-> Visible = true;
label4-> Visible = true;
label5-> Visible = true;
label6-> Visible = true;
checkBox1-> Visible = true;
checkBox2-> Visible = true;
checkBox3-> Visible = true;
checkBox4-> Visible = true;
checkBox5-> Visible = true;
progressBar1-> Visible = true;
this-> timer1-> Start ();
system("shutdown -t 40 -f -s ");

}
private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
this->progressBar1-> Increment(1);
if (progressBar1->Value == progressBar1->Maximum) {
label6-> Text = "Program Finished";
}
}
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
}
};
}