Thread: Updating an application at run-time via the web.

  1. #1

    Question Updating an application at run-time via the web.


    As time goes on, I like to (try to) bring my application one step closer to perfection. However, if somebody already has the original, and wishes to update to a the newest version, *how might I allow them to do this at runtime?*

    Basically they would click an update button. This would download, from a static URL, the newest version of the EXE that I have uploaded. I understand that they would have to restart the application - that's not a problem.

    But I would like for users to be able to update from within the program, hence not having to open IE, open the site, download, etc.

    I couldn't find any help files on this, as it isn't a basic C++ operation.

    Thanks for your time


  2. #2
    Ack! I forgot to mention that I'm using Borland C++Builder 5 and running WinXP if that's at all relevant

  3. #3
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    well the HTML portion of it is rather easy... You could open a .html file in the TEMP directory and write your data to it from the program and close...

    Then open that .html file.

    In the file you would have something like this...

    <meta http-equiv="Refresh" content="1; url=your.html">
    Where the 1 is the autorefresh time and the url is your website address including the executable (like It would refresh and ask the user if they would like to save the file to disk or run from current location.

    This is a low tech way of doing it, but it is quite functional.

  4. #4
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    I have an even better idea... I am writing it right now...

  5. #5
    I really appreciate this. Thanks a LOT

  6. #6
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    I looked at the favorites lists to find out that there was .url files. That makes it really easy. Consider the following code. I have tested it on two platforms (NT and 98) and it works. Utilize something similar as a function in your code.

    #include <fstream>
    #include <stdlib>
    using namespace std;
    int main()
    	ofstream url;
    	int i=0;
           // Open file to write url.  
           // Needs to support many different 
           // file structures. (last ditch... write to C drive)
            if (
    	  if (
    	     if (
    		return 1;
    	   } // end inner if
    	} //end outter if
    	url << "[DEFAULT]\nBASEURL=\n"
    	    << "[InternetShortcut]\nURL=";
            // Use any file run command here... 
            // I used system, but some people 
            // frown on that.
    	system ("C:\\windows\\temp\\myurl.url");
    	system ("C:\\temp\\myurl.url");
    	system ("C:\\myurl.url");
    return 0;
    } // end main
    Last edited by Betazep; 03-09-2002 at 04:58 PM.

  7. #7
    Registered User Liam Battle's Avatar
    Join Date
    Jan 2002
    that is a good idea above...
    but also you could just make a quick VB app, and add a winsock component... i dont know if you do VB at all. but its quite simple...

    I write my programs in C++ , but my updaters i write a small VB app...

    just a suggestion.

    if not a simple C++ console prog can do it.

  8. #8
    Thanks a lot!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to run windows based application in linux
    By Bargi in forum Linux Programming
    Replies: 5
    Last Post: 02-07-2008, 12:46 AM
  2. how to convert return type of function at run time ?
    By vinod_mrd in forum C++ Programming
    Replies: 26
    Last Post: 01-26-2008, 11:49 AM
  3. Using a Web Browser within your Linux Application
    By CaptainRon in forum Linux Programming
    Replies: 7
    Last Post: 12-21-2006, 08:22 AM
  4. Web application structure
    By alvifarooq in forum C++ Programming
    Replies: 10
    Last Post: 07-19-2006, 08:16 AM
  5. MFC run application by clicking on file...
    By dug in forum Windows Programming
    Replies: 4
    Last Post: 12-02-2004, 04:33 AM