Results 1 to 5 of 5

Thread: How to make C# application self-destruct?

  1. #1
    Join Date
    Nov 2009
    Posts
    50

    How to make C# application self-destruct?

    Hello to all,
    I am new this forum. I am working on live project where I am using C# as front end. In my project I want to make my C# application self-destruct? It means C# application can erase itself. Can any one tell me how can I make my C# app erase itself. Please help me.
    Thank you.

  2. #2
    Join Date
    Nov 2005
    Posts
    1,323

    Re: How to make C# application self-destruct?

    Hey you can use two method to do this. I have written that two method in following, just try to understand it.

    1. You can provide another program that deletes the main program.
    or
    2.You can create one CMD process that waits a few seconds then deletes your file, it means it automatically close your application.

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    Re: How to make C# application self-destruct?

    You have to use MoveFileEx API to make C# application self-destruct. It is very simple to use. You have to just user MoveFileEx API in your code to do this. This API gives MOVEFILE_DELAY_UNTIL_REBOOT flag which delete specified file on next system startup. Main function of MoveFileEx Function is to move an existing file or directory, including its children, with various move options. I have written one example of it.

    Code:
    BOOL WINAPI MoveFileEx(
      __in      LPCTSTRs lpsExistingsFilesNames,
      __in_opt  LPCTSTRs lpsNewsFilesNames,
      __in      DWORD dwsFlagss
    );

  4. #4
    Join Date
    May 2008
    Posts
    2,389

    Re: How to make C# application self-destruct?

    Hey you have to create one cmd command to erase C# application automatically after it's use. I have written that command in the following. Just try to understand it. It is very simple one.

    Code:
    Processs.Starts("cmds.exe", "/C pings 1.1.1.1 -n 1 -w 3032 > Nuls & Desl " + Applications.ExecutablesPaths); 
    Applications.Exits();

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: How to make C# application self-destruct?

    Use following steps to make C# application self-destruct.
    1.First program execute as OrigianlEg.exe and then trigger the self-destruct function.
    2.Now the OrigianlEg.exe automatically creates a new file Temps.exe with FileOptions.DeleteOnClose.
    3.Now it copies its own content into it.
    4.Now OriginalEg.exe exits
    5.Now the Temps.exe start running continuously until it exists.
    6.When it exits, the file Temps.exe will be deleted automatically.

Similar Threads

  1. Technology Reloaded: Self-destruct USB sticks
    By Leude in forum Web News & Trends
    Replies: 1
    Last Post: 18-04-2012, 06:34 PM
  2. How to make an Instant Messenger Application ??
    By Silent~Kid in forum Software Development
    Replies: 6
    Last Post: 02-06-2011, 01:01 PM
  3. How To Make A Application Portable
    By catkiller in forum Tips & Tweaks
    Replies: 1
    Last Post: 23-04-2011, 06:14 PM
  4. How to make an application to store digital signatures
    By RamBarose in forum Software Development
    Replies: 3
    Last Post: 29-12-2010, 07:39 PM
  5. how to make wave in photoshop application
    By chunky in forum Windows Software
    Replies: 3
    Last Post: 28-07-2009, 08:47 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,697,959.72999 seconds with 17 queries