Code:
#include <iostream> //Couting and everything else
#include <windows.h> //Functions
#include <cstdlib> //Srand() and rand()
#include <ctime> //Seeding a random number out of time
#define BLOCK (char)219 //A BLOCK
#define TOP_RIGH (char)187 //TOP RIGHT CORNER
#define BOT_RIG (char)188 //BOTTOM RIGHT CORNER
#define VERTICA (char)186 //A VERTICAL LINE
#define BOT_LEF (char)200 //BOTTOM LEFT CORNER
#define TOP_LEFT (char)201 //TOP LEFT CORNER
#define STRAIGHT (char)205 //A HORIZONTAL LINE
bool SetColor(WORD COLOR); //FOR THE COLOR
void DRAW(); //TO DRAW THE OUTLINES
void gotoxy(int x,int y); //TO POSITION THE CURSOR
void Full(); //FOR FULL SCREEN
void Format(); //FORMAT SIMULATION
void Announce(); //ANNOUNCING WARNINGS
void Check(); //A CHECK SEQUENCE
using namespace std; //FOR COUT,ENDL, ETC.
//TEXT COLOR LT BLUE
WORD F_COLOR_BLUE = FOREGROUND_BLUE | FOREGROUND_INTENSITY ;
//TEXT COLOR BR YELLOW
WORD F_COLOR_YELLOW = FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY;
//BACKGROUND COLOR LT BLUE
WORD F_COLOR_BK_BLUE= BACKGROUND_BLUE | BACKGROUND_INTENSITY;
//THE COMBINATION THAT WILL BE USED
WORD F_COLOR_COMBINATION=F_COLOR_YELLOW | BACKGROUND_BLUE | BACKGROUND_INTENSITY;
int main()
{
SetConsoleTitle("SETUP");//Just in case
Full(); //Set the program to full-screen
SetColor( F_COLOR_COMBINATION );//Set the text with yellow text & blue background
DRAW(); //Draw the outlines
Announce(); //Announce the Warnings
Check(); //A simulation "Check"
Format(); //A simulation "Format"
gotoxy(20,44); //<---Go at the bottom
system("PAUSE"); //Let the user see the screen
return 0; //Say bye-bye
}
bool SetColor(WORD F_COLOR)//Here it sets the color to which ever color you want
{
//Here it gets a handle that gets the a pointer to the
//output of the console
HANDLE hndl = GetStdHandle(STD_OUTPUT_HANDLE);
//Set the color of the text to which ever color you like
SetConsoleTextAttribute( hndl , F_COLOR );
return TRUE;
}
void gotoxy(int x,int y) //The Gotoxy Function That made drawing easier!
{
HANDLE hConsoleOutput; //A handle for our console
COORD dwCursorPosition; //A COORD for a Function
dwCursorPosition.X = x; //Getting x value from programmer
dwCursorPosition.Y = y; //Getting y value from programmer
//Getting a valid handle the points to the
//output of the console
hConsoleOutput = GetStdHandle
(STD_OUTPUT_HANDLE);
//Go to those coordinates
SetConsoleCursorPosition (hConsoleOutput,dwCursorPosition);
}
void DRAW()
{
//}This is the how outline, that outlines the whole screen
cout<<"\n"<<TOP_LEFT; //This is the top left corner of the whole outline
for(int x=0; x<77; x++)
{
cout<<STRAIGHT; //Here we go straight to the other corner
}
cout<<TOP_RIGH<<endl; //This is the top right corner of the whole outline
for(x=0; x<47; x++) //}This Process Covers both columns on each side
{
cout<<VERTICA<<
" " //} A big 78 space
" " //
" "<<VERTICA<<endl;//} A big 78 space
}
cout<<BOT_LEF; //This Makes the Bottom Left Corner
for(x=0; x<77; x++)
{
cout<<STRAIGHT; //}This goes from the bottom-left to the right
}
cout<<BOT_RIG<<endl; //This makes the Bottom Right Corner
//}This is the how outline, that outlines the whole screen
gotoxy(10,38); //<--- Go around the Bottom Of the screen
//Create a box in where progress will be done...
cout<<TOP_LEFT; //Create the Top Left Corner of the Progress-Bar
for(x=0; x<53; x++)
{
cout<<STRAIGHT; //}Here we go from the top-left to the top-right
}
cout<<TOP_RIGH<<endl; //Create the Top Right Corner of the Progress-Bar
gotoxy(64,39); //<--- Go 2 lines down and x-position of the Top Left
cout<<VERTICA; //Make a vertical, for helping us closing the box
gotoxy(10,39); //<--- Go to the other side to do the same thing
cout<<VERTICA; //Make a vertical
gotoxy(10,40); //Go to the bottom of the first vertical
cout<<BOT_LEF; //Create the Bottom Left Corner
for(x=0; x<53; x++)
{
cout<<STRAIGHT; //}Here you make a line all the way to the other side
}
cout<<BOT_RIG; //Make the Bottom Right Corner
gotoxy(35,4); //And Finally
cout<<"-------";
gotoxy(34,5);
cout<<"| SETUP |"; //}THE TITLE "SETUP"
gotoxy(35,6);
cout<<"-------";
}
void Full() //FULL-SCREEN FUNCTION
{
keybd_event(VK_MENU, 0x38, 0, 0);
keybd_event(VK_RETURN, 0x1c, 0, 0);
keybd_event(VK_RETURN, 0x1c, KEYEVENTF_KEYUP, 0);
keybd_event(VK_MENU, 0x38, KEYEVENTF_KEYUP, 0);
}
void Announce() //Here it just couts the warnings...
{
gotoxy(10,10); //Go at the top
Sleep(1000); //Sleep for a second
//1st Warning
cout<<"\a-> PRECAUTION! A VIRUS HAS ENTERED YOUR SYSTEM!";
Sleep(5000); //Sleep for 5 seconds
gotoxy(10,12); //Go below the 1st Warning
//2nd Warning
cout<<"\a-> SETUP IS TRYING TO FIX THE PROBLEM!";
Sleep(5000); //Sleep for 5 seconds
gotoxy(10,14); //Go below the 2nd Warning
//3rd Warning
cout<<"\a-> SHUTTING OFF YOUR COMPUTER WILL CAUSE THE LOSS OF ALL DATA!";
Sleep(5000); //Sleep for 5 seconds
}
void Check()
{
for(int x=0; x<40; x++) //Repeat the process for 40 times...
{
gotoxy(10,25); //Go to a place
//Cout a loading character
cout<<"Trying to fix the Problem |";
Sleep(100); //Sleep for a while
gotoxy(10,25); //Go to the same place
//Cout a loading character
cout<<"Trying to fix the Problem /";
Sleep(100); //Sleep for a while
gotoxy(10,25); //Go to the same place
//Cout a loading character
cout<<"Trying to fix the Problem -";
Sleep(100); //Sleep for a while
gotoxy(10,25); //Go to the same place
//Cout a loading character
cout<<"Trying to fix the Problem \\";
Sleep(100); //Sleep for a while
}
}
void Format() //Here is where the simulation of formating
{ //takes place!
gotoxy(7,20); //Go somewhere to cout a star, and start couting
cout<<"\a->"; //Here it prints the star '*'
gotoxy(10,20); //Cout that Checking failed and formating is about
//to take place
cout<<"SETUP COULDN'T FIX THE PROBLEM, SETUP WILL FORMAT THE COMPUTER";
gotoxy(10,22); //<---Go Somewhere, where there is more space
//Giving more false-additional information
cout<<"SO THE VIRUS DOESN'T CREATE PERMANENT DAMAGE TO YOUR MACHINE";
int ix = 12; //Initialize a variable that will hold an x-coord.
gotoxy(10,35); //<---Go Somewhere to cout for what is below
cout<<"FORMATTING VOLUME 'C:' ";
for(int x=0;x<101;x+=2) //In here it will cout a Block for a random time
{
//Seed the random number
srand((unsigned)time(NULL));
int random = rand() % 10000; //Random number between 0-9 sec
gotoxy(35,36); //<---Go to cout the percent
cout<<x<<"%"; //Cout The Percent Done
Sleep(random); //Sleep for a random time interval from 0 to 9 sec.
gotoxy(ix,39); //<---Go to a position to cout the Block
cout<<BLOCK; //Cout the Block
ix++; //Move one to cout the next block
}
gotoxy(20,42); //<---Go somewhere, where there is space
//Cout that there computer has succesfully
//Been formatted! HAHAHAH!!
cout<<"\aSETUP HAS FINISHED DELETING YOUR COMPUTER";
}