المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Cannot delete file....used by another process.....help guyz!



C# Programming
04-06-2009, 11:54 AM
Hi there,

Ocassionally, due to malware infection, it is seen that some of the infected or suspicious files or folders can be neither deleted nor renamed and when tried to do so, a messagebox is display something like this: "The file/directory cannot be deleted because it is in use by another program or whatsoever". In such case, we have two options, either format the drive containing the file or continue with it.

However, let me directly come to the point. I have written a program which will create a directory with the following code:

{
System.IO.Directory.CreateDirectory("c:/myfolder");
}

With the above code, I have created a folder "myfolder" in the c: drive. But, this folder can be easily deleted. I want to know that how can I create a process or program associated with it running continuously, such that whenever the user tries to delete the folder, the messageBox "The file/directory cannot be deleted because it is in use by another program" is displayed and the user fails to delete it?

Help me and I assure that your help will be appreciated,
Thanx..... and sorry for my poor english (I am trying to improve),
Rajdeep.NET http://www.barakasoft.com/script/Forums/Images/smiley_sigh.gif