|
-
Jul 11th, 2000, 02:43 AM
#1
Thread Starter
New Member
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
-
Jul 11th, 2000, 02:56 AM
#2
Frenzied Member
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.
-
Jul 11th, 2000, 02:57 AM
#3
Lively Member
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
Some cause happiness wherever they go; others, whenever they go.
-
Jul 11th, 2000, 11:40 AM
#4
Thread Starter
New Member
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|