Self-Installer

This is a discussion on Self-Installer within the C++ Programming forums, part of the General Programming Boards category; Hello, I want to make a program that installs it self to a given directory, yet I don't know how ...

  1. #1
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103

    Self-Installer

    Hello, I want to make a program that installs it self to a given directory, yet I don't know how to do it....I need a program that erases itself, where ever it is, and copies itself to the directory it was given, such as:

    Code:
    #include <iostream>
    
    using namespace std;
    
    char address[80];
    
    int main()
    {
         cout<<"Where do you wish to install this program? : "<<endl;
         cin.getline(address,80,'\n');
    
         return 0;
    }
    Program output:
    Code:
    Where do you wish to install this program? :
    C:\Program Files\
    Yet I don't know how to get there, can someone help me?? Please....

  2. #2
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    generally you use an installer system for this rather then coding it in your application. Google for installshield ($$$) or inno setup (free).

    also if you have visual studio.net you can create a setup project (which might need .net runtime, but I'm not sure)
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  3. #3
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Be prepaired to spend a few days learning how to use one to these install programs... I've never done it myself, but my company sent a programmer to a seminar to learn the Wise Installer. (Like InstallShield, it's too expensive for hobby use.) I was surprised that he actually had to take a class to learn something "simple" like that!
    Last edited by DougDbug; 02-28-2006 at 11:17 AM.

  4. #4
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103
    Not really what I wanted....Hmm..... Um let me put it this way.....
    Code:
    #include <iostream>
    //Here I would include any necessary IO library....
    //Possibly <fstream.h> or <io.h>
    
    using namespace std;
    
    int main()
    {
         /* { Do Program Stuff Here : } */
    
         if(  /* IF Backup does not already exists in My Documents */ )
          {
              CreateBackUp("C:\My Documents");
              cout<<"Program was back-uped in My Documents";
          }
    
           else
            {
                   //Continue with program
            }
    
            return 0;
    }
    Code:
    Program was back-uped in My Documents
    I just want to make a program that backs-ups itself on My Documents, I don't want to make the user putting the address...it always annoys me.... so instead, I Put it somewhere and tell him where it is....I always put my backup stuff in My Documents....

    Can someone help me....?

  5. #5
    semi-colon generator ChaosEngine's Avatar
    Join Date
    Sep 2005
    Location
    Chch, NZ
    Posts
    597
    Quote Originally Posted by toonlover
    I just want to make a program that backs-ups itself on My Documents, I don't want to make the user putting the address...it always annoys me.... so instead, I Put it somewhere and tell him where it is....I always put my backup stuff in My Documents....

    Can someone help me....?
    first nothing is guarenteed to annoy users more then a program telling them where it's going to copy it's file. Not everyone backs up to my documents.

    second, why do you want to back up the program? I can understand backing up the users files, but it's not likely the exe will be overwritten.

    However, if you're determined to do this, look into CopyFile on msdn.
    "I saw a sign that said 'Drink Canada Dry', so I started"
    -- Brendan Behan

    Free Compiler: Visual C++ 2005 Express
    If you program in C++, you need Boost. You should also know how to use the Standard Library (STL). Want to make games? After reading this, I don't like WxWidgets anymore. Want to add some scripting to your App?

  6. #6
    Registered User Frobozz's Avatar
    Join Date
    Dec 2002
    Posts
    546
    A tool I'd recommend is the Nullsoft Scriptable Install System aka NSIS.

    NSIS allows you to create stable, quick and user friendly installers that are capable of installing, uninstalling, setting system settings, extracting files and more. With the NSIS scripting language you can implement any custom logic you want.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. typical operations of an installer
    By stanlvw in forum Windows Programming
    Replies: 4
    Last Post: 05-30-2008, 08:07 AM
  2. Linux software installer recommendations
    By BobS0327 in forum Tech Board
    Replies: 13
    Last Post: 09-24-2006, 01:19 AM
  3. Visual Studio Installer Privilege Issue
    By mercury529 in forum Windows Programming
    Replies: 4
    Last Post: 01-30-2006, 12:48 PM
  4. Installer Program
    By Junior89 in forum C++ Programming
    Replies: 4
    Last Post: 01-17-2005, 12:49 AM
  5. Windows Installer Problem on XP
    By Sh0t in forum Tech Board
    Replies: 4
    Last Post: 10-14-2002, 02:11 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21