# Installer in C++

## Recommended Posts

CodeTitan    258
I want to make an installer for a game that I am writing. However, there are some specific routines that must be done (such as getting things from the CD). I use C++. I want this to be an installer like those for Starcraft and Halo PC. Does anyone have an idea for a starting point?

##### Share on other sites
Rebooted    612
Most programs use something like InstallShield to make an installer. Inno Setup and NSIS are two free such programs.

##### Share on other sites
Programmer16    2321
The only way that I know of is to use the CopyFile() function.

Say you have the user select the location of the cd and its in drive d.

You need to copy file GameName.exe to folder c:\CompanyName\GameName\GameName.exe:

if(!CopyFile("d:\\GameName.exe", "c:\\CompanyName\\GameName\\GameName.exe", true)){	if(MessageBox(NULL, "File *Filename* exists, overwrite?", "Overwrite", MB_YESNO) == IDYES)	{		CopyFile("d:\\GameName.exe", "c:\\CompanyName\\GameName\\GameName.exe", false);	}	else	{		//continue to copy or quit	}}//File has been copied from// d:\\GameName.exe to// c:\\CompanyName\\GameName\\GameName.exe

Hope that helps!

## Create an account

Register a new account