Updating an application at run-time via the web.

This is a discussion on Updating an application at run-time via the web. within the C++ Programming forums, part of the General Programming Boards category; Greets, As time goes on, I like to (try to) bring my application one step closer to perfection. However, if ...

  1. #1
    Unregistered
    Guest

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

    Greets,

    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

    John

  2. #2
    Unregistered
    Guest
    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
    Posts
    1,412
    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...

    Code:
    <html>
    <head>
    <meta http-equiv="Refresh" content="1; url=your.html">
    </head>
    <body>
    </body>
    </html>
    Where the 1 is the autorefresh time and the url is your website address including the executable (like http://www.mysite.com/myexe.exe). 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.
    Blue

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

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

  6. #6
    _B-L-U-E_ Betazep's Avatar
    Join Date
    Aug 2001
    Posts
    1,412
    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.

    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)
    
    	url.open("C:\\windows\\temp\\myurl.url");
            if (url.fail())
    	{
    	  ++i;
    	  url.open("C:\\temp\\myurl.url");
    	  if (url.fail())
    	  {
    	     ++i;
                 url.open("C:\\myurl.url");
    	     if (url.fail())
    		return 1;
    	   } // end inner if
    	} //end outter if
    
    	url << "[DEFAULT]\nBASEURL=http://www.yahoo.com\n"
    	    << "[InternetShortcut]\nURL=http://www.yahoo.com";
    
    	url.close();
    
            // Use any file run command here... 
            // I used system, but some people 
            // frown on that.
    
    	if(i==0)
    	system ("C:\\windows\\temp\\myurl.url");
    
    	if(i==1)
    	system ("C:\\temp\\myurl.url");
    
    	if(i==2)
    	system ("C:\\myurl.url");
    
    return 0;
    
    } // end main
    Last edited by Betazep; 03-09-2002 at 04:58 PM.
    Blue

  7. #7
    Registered User Liam Battle's Avatar
    Join Date
    Jan 2002
    Posts
    114
    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
    Unregistered
    Guest
    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, 09: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

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