Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
Hello to everybody
I have C# project and when somebody delete project's exe(project.exe) I dont wanted to be deleted.
Can I do project.exe's visible false when when somebody trying to delete ?
Or can I give MessageBox("you cannot delete exe") when somebody trying to delete ?
It looks like triggers (instead of delete triggers etc.).
Posted 3-Aug-12 4:31am
Edited 5-Aug-12 22:38pm
v11
Comments
Collin Jasnoch at 3-Aug-12 9:40am
   
This makes no sense. You are deleting the file but do not want it deleted?
Solution is to not delete the file.
aspnet_regiis at 3-Aug-12 9:42am
   
Even if it is deleted, then you can recover it from recycle bin.. So not to worry
aspnet_regiis at 6-Aug-12 4:48am
   
Better way you should use Windows + R > cmd 'Enter' > FORMAT D: .... Its better then Shift+Delete
Wes Aday at 3-Aug-12 9:42am
   
Sure you can do that but there is no point. The only reason that someone would "hide" the exe would be if they are writing malicious software.
Wes Aday at 3-Aug-12 9:49am
   
That makes no sense at all.
Wes Aday at 3-Aug-12 9:58am
   
Learn what? Nothing you have said makes any sense at all. I realize the English may not be your native language but your question and comments do not make any sense.
Dave Kreskowiak at 3-Aug-12 10:43am
   
Actually, no it doesn't make any sense.
 
If you're asking how to prevent the .EXE file from being deleted, you don't do anythis at all. Default security configuration prevents normal users from doing ANYTHING at all, including deleting files, to anything under Program Files or it's subfolders.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

The only way to accomplish this is to have a second program that monitors "project.exe". In Windows, you can't delete an executable that's running, and if it isn't running it can't do anything. There are no events sent to a program upon it's deletion because it isn't running, so there is no place to send events to.
 
But even if you wrote a second program, it's a trivial task to stop that one from running and delete it anyways. What you're asking for is simply too impractical for any normal use (the only place I've seen similar behavior is malware, so you'll have to excuse me if I won't go into any more details).
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

You own the software ..not the user's computer..So let the user decide whether to keep your program or delete it..You should not force him to keep your software. The user can file a law suit against you if he is unable to delete your program.
 
Read more details here related a similar case ..
 
http://en.wikipedia.org/wiki/Sony_BMG_copy_protection_rootkit_scandal[^]
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web02 | 2.8.1411022.1 | Last Updated 6 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100