Results 1 to 8 of 8

Thread: Self-kill: impossible?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 1999
    Location
    Prague, Czech Republic
    Posts
    350

    Post

    Hello everybody!
    I need to delete the MyApp.exe from MyApp.

    HOW?

    [This message has been edited by Jhd.Honza (edited 01-31-2000).]

  2. #2
    Guest

    Post

    I don't think you can do it with your program running but it could be done during the startup/reboot process. You could attach a link to the user's autoexec.bat to delete it but then the line would still be there each time they start up. There is a registry key that may be usefull too
    HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
    I believe that both Win 98 and 95 use this key. I can't vouch for any other versions.

    [This message has been edited by nookta (edited 01-31-2000).]

  3. #3
    Hyperactive Member Juan Carlos Rey's Avatar
    Join Date
    Aug 1999
    Location
    Mendoza, Argentina
    Posts
    301

    Post

    I don't think that will be complicated, cause every exe is run from memory, not from disk, then deleting (killing) the file will keep your app running until you exit, and then it disappears.
    (Am I clear???)



    [This message has been edited by Juan Carlos Rey (edited 01-31-2000).]

  4. #4
    Member
    Join Date
    Feb 1999
    Location
    NY
    Posts
    45

    Post

    You can't delete an application while it's running, Windows (or any OS) locks write access to the file so you can't do jack to it. You could try to call a batch file but then how would you delete that, bah. Good Luck

    ------------------
    -Mystiq

  5. #5
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845

    Post

    Batch files can self delete!

    put this in a file called c:\delete.bat
    Code:
    :start
    del "c:\myexe.exe" 
    if exist "c:\myexe.exe" goto start
    
    del c:\delete.bat
    and it will delete itself

    Your exe could write this code and then shell()it (with vbhide)
    ------------------
    Mark Sreeves
    Analyst Programmer

    [email protected]
    A BMW Group Company




    [This message has been edited by Mark Sreeves (edited 02-01-2000).]

  6. #6
    Hyperactive Member Juan Carlos Rey's Avatar
    Join Date
    Aug 1999
    Location
    Mendoza, Argentina
    Posts
    301

    Post

    You are absolutely right. I was thinking of my old times as QB 7 programmer. That happens when one trusts his memory and don't test his answers!
    EXCUSE.ME

  7. #7
    Junior Member
    Join Date
    Jan 2000
    Location
    MFAU
    Posts
    19

    Post

    there is a file in the windows directory you can place a path in, when the system reboots the file at that path is deleted, i am not sure what the file is called sorry

  8. #8
    Guest

    Post

    I've done it before with the batch file method, but it really does seem dodgy.

    Surely there's a better way?

    ------------------
    Matthew Ralston
    E-Mail: [email protected]
    ICQ: 31422892
    Web Site: My Home Page
    AKA: ...::: The Fragmeinster :::... (On Quake 3 World Forums)

    Sorry about my English, but my Scouse is dead good!

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