473,725 Members | 2,243 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Overwrite current exe?

Can someone point me towards something explaining how to overwrite an exe
that is currently being executed, if even possible?

I'm trying to build in an update routine to ahve it look for a newer version
of itself on the network and then copying that new version on itself... of
course I keep getting an IOException because the file is 'In use by another
Process'

Thanks a bunch,

Matt
Nov 20 '05 #1
5 8116
Why don't you launch a small application and quit your process!! the newly
launched app can then copy the new exe !! just an idea thats all...

"MattG" <re********@sta ndardpub.com> wrote in message
news:OL******** ******@TK2MSFTN GP12.phx.gbl...
Can someone point me towards something explaining how to overwrite an exe
that is currently being executed, if even possible?

I'm trying to build in an update routine to ahve it look for a newer version of itself on the network and then copying that new version on itself... of
course I keep getting an IOException because the file is 'In use by another Process'

Thanks a bunch,

Matt

Nov 20 '05 #2
* "MattG" <re********@sta ndardpub.com> scripsit:
Can someone point me towards something explaining how to overwrite an exe
that is currently being executed, if even possible?
That's impossible.
I'm trying to build in an update routine to ahve it look for a newer version
of itself on the network and then copying that new version on itself... of
course I keep getting an IOException because the file is 'In use by another
Process'


<http://windowsforms.ne t/articles/appupdater.aspx >

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #3
On 2003-11-05, MattG <re********@sta ndardpub.com> wrote:
Can someone point me towards something explaining how to overwrite an exe
that is currently being executed, if even possible?

I'm trying to build in an update routine to ahve it look for a newer version
of itself on the network and then copying that new version on itself... of
course I keep getting an IOException because the file is 'In use by another
Process'

Thanks a bunch,

Matt


Matt,

Not really possible. It seems there are some steps you can do to get
your file in the rename queue, so that it will replace the current file
after a reboot - but I can't remember the exact process (though I'm sure
it could be googled rather quickly :), but I don't think that is exactly
what you want.

Personally, if I were you - I would develop your updater as a separate
application. Then, set all your links to point to it at install. It
could go out, check for updates and if it finds them - download them and
put them in place. Once it's done with that, then it would launch your
reall application and exit.

--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #4
Thanks everyone, that's what I ended up doing.. It should work pretty
good... only problem I see with having a seperate app is that I can't have
THAT program do an auto update hehe.

Matt

"Tom Shelton" <to*@mtogden.co m> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
On 2003-11-05, MattG <re********@sta ndardpub.com> wrote:
Can someone point me towards something explaining how to overwrite an exe that is currently being executed, if even possible?

I'm trying to build in an update routine to ahve it look for a newer version of itself on the network and then copying that new version on itself... of course I keep getting an IOException because the file is 'In use by another Process'

Thanks a bunch,

Matt


Matt,

Not really possible. It seems there are some steps you can do to get
your file in the rename queue, so that it will replace the current file
after a reboot - but I can't remember the exact process (though I'm sure
it could be googled rather quickly :), but I don't think that is exactly
what you want.

Personally, if I were you - I would develop your updater as a separate
application. Then, set all your links to point to it at install. It
could go out, check for updates and if it finds them - download them and
put them in place. Once it's done with that, then it would launch your
reall application and exit.

--
Tom Shelton
MVP [Visual Basic]

Nov 20 '05 #5
Here is how I did it:

1. check to see if there is new version available, if yes then
2. download it to local folder as whatever.exe, then
3. Shell local folder & "\" & whatever.exe & App.Path, vbNormalFocus
[you need to tell where the current exe is runing from]
4. Quit the current app from memory

Step 3 is runing the new version, what the new version does are:
1. get the command line input, that's the current exe location
2. wait for several seconds (use timer or whatever you like) then
3. Kill Commandlineinfo & "\" & yourapp.exe
Name App.Path & "\" & App.EXEName & ".exe" As Commandlineinfo & "\"
& yourapp.exe

Now you are running a new version and the file is also updated on
local folder whereever your exe is usually running from.

I run checknew on form_load and + a timely check, the application
updates itself without user even noticing it.
You can download my app from:
http://www.simtel.com/product.php?id=73610, it is a single file world
wild weather forecast application.
"MattG" <re********@sta ndardpub.com> wrote in message news:<uH******* ******@TK2MSFTN GP12.phx.gbl>.. .
Thanks everyone, that's what I ended up doing.. It should work pretty
good... only problem I see with having a seperate app is that I can't have
THAT program do an auto update hehe.

Matt

"Tom Shelton" <to*@mtogden.co m> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
On 2003-11-05, MattG <re********@sta ndardpub.com> wrote:
Can someone point me towards something explaining how to overwrite an exe that is currently being executed, if even possible?

I'm trying to build in an update routine to ahve it look for a newer version of itself on the network and then copying that new version on itself... of course I keep getting an IOException because the file is 'In use by another Process'

Thanks a bunch,

Matt


Matt,

Not really possible. It seems there are some steps you can do to get
your file in the rename queue, so that it will replace the current file
after a reboot - but I can't remember the exact process (though I'm sure
it could be googled rather quickly :), but I don't think that is exactly
what you want.

Personally, if I were you - I would develop your updater as a separate
application. Then, set all your links to point to it at install. It
could go out, check for updates and if it finds them - download them and
put them in place. Once it's done with that, then it would launch your
reall application and exit.

--
Tom Shelton
MVP [Visual Basic]

Nov 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
7489
by: Gord | last post by:
Hello, If you set the flag for an overwrite prompt using the 'Save' common dialog, how do you read the response when the user clicks the Yes or No in the 'overwrite' message box? Everything I've read explains about setting the flag to bring up the overwrite prompt message box, but there's no explanation on how to read the response to it. It appears that clicking the Yes option doesn't actually overwrite the old file, so I assume I'm...
3
1587
by: LC | last post by:
Hi, I would like to know how I can save my current ASP page to the server side in html file format. Then I would like to stream it back to the client side. Any help is very much appreciated. Thanks,
2
1369
by: LC | last post by:
Hi, Many Weeks ago I posted this: I would like to know how I can save my current ASP page to the server side in html file format. I got a very nice reply back from Scott McNair. Thank you very much Scott. This code was provided by Scott:
6
1768
by: bugbear | last post by:
I'm trying to implement the purest and simplest tab styling I can. So I'd like each tab to be a box with left-top-right borders. The "row of tabs" sits on top of the content box. The content box clearly needs a left-bottom-right border. The "line" between the tabs and the content can either be a bottom border on the tabs (or a box containing the tabs) or a top border on the content box.
0
1780
by: AC | last post by:
Hi all, I'm using .NET 2003 and trying to use the status bar to display current key states, as so very many apps do - like num lock, caps lock, etc. I'm using the following code (in c sharp but equally applicable to vb, c++ etc.): private static extern short GetKeyState(int keyCode); private const int VK_CAPITAL = 0x14; private const int VK_INSERT = 0x2D;
2
27762
by: B-Dog | last post by:
Is there a way to make vb.net to overwrite the file when moving? Here is what I'm trying to do: If System.IO.File.Exists(dest) Then 'handle overwrite here If MessageBox.Show("Do you want to overwrite", "Overwrite File?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
3
5546
by: Developer | last post by:
I use the RichTextBox and sometimes put it into overwrite mode. I'd like the cursor to show whether its in overwrite or insert mode. I often use Cursor.Current = Cursors.WaitCursor and therefore need to change the cursor to show the overwrite/insert mode in such a way that when the Cursor.Current is reset after the need for the wait cursor ends, the cursor resets to the overwrite cursor or insert cursor as appropriate.
1
1995
by: Killer42 | last post by:
Hi all. I have a question from a colleague. He is creating a form in Word2003, which has a date field on it. He wants to set the default value to the current date, but allow the user to overwrite it. How can he do so? (He doesn't want to bother registering with TSDN, so I agreed to post the question.) If he sets it as a current date field, it doesn't allow overwrite. But it seems as though the default value has to be a hard-coded date/time...
2
6461
by: hzgt9b | last post by:
I know how to overwrite a function. Normally this is what I would do: function someFunction() { /* orig definition here */ } //later in the execution stream I would do... someFunction = function () { /* overwrite function definition */ } The above works fine for me even when someFunction is originally defined in a seperate frame other than the code that overwrites it (obviously on the same domain). What I don't know how to-do is...
0
8889
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8099
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6011
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.