-1

I need a way to trick another program into thinking a file is already in use using C#.

Alexei Levenkov
  • 96,782
  • 12
  • 124
  • 169

1 Answers1

1

If you want to 'trick' the system you should just open the file in the C# code.

This will result in a 'Process cannot access file because another process is currently using the file' type message.

In C# just use the File.Open() method and avoid calling the Close() method.

Rob Aston
  • 818
  • 13
  • 19
  • it throws an error saying its missing "Desktop.ini" from my din/debug folder? – Jake Tigchelaar May 20 '13 at 00:11
  • I'm not sure this is caused by using the open method. If you have any other projects or code in the solution that would require this file then you may need to place it there yourself. – Rob Aston May 20 '13 at 00:31