Results 1 to 4 of 4

Thread: Kill File Problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    7

    Cool

    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

  2. #2
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    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.

  3. #3
    Lively Member
    Join Date
    Mar 2000
    Posts
    81
    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.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2000
    Posts
    7
    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
  •  



Click Here to Expand Forum to Full Width