-
Hey,
Im running 2K and am trying to do
Kill (App.Path & "\file.exe")
Name App.Path & "\filebackup.exe" As App.Path & "\file.exe"
now the file im trying to kill is the file that is running,
and because it's in memory it gives me a File Access error,
is there any way of doing this in the program or will i have
to make another program to kill it, when file.exe is not in memory?
Thanks,
MusixMan
-
You'll have to make a separate exe, a very simple one, it has no forms just a module, something like this
Code:
Public Sub Main()
Dim i As Long
i = Timer
On Error Resume Next
Do While Timer < i + 10
DoEvents
Loop
Kill Command$
Call it Kill.exe
then from your App
Code:
Shell "Kill.Exe " & App.Path & "\" App.ExeName
End
That'll Kill the running app.
DON'T RUN THIS BEFORE IT'S COMPILED IT'LL DELETE VB
Why are you Doing this BTW, I made a program that deleted a file while it was open when I was 14, It Crashed every machine on the network and got us out of the IT lesson.
-
You'll have to create another app that does the exe renaming - Windows locks the entire exe while it's running.
Probably not what you wanted to hear but c'est la vie!
Toot
-
It's for a updating feature to my program, i just diden't want to have to included another program that's all, ill just detected if the file i want to update is loaded in memory then prompt to close it, then i can update it.
Thanks
MusixMan