Most likely, you simply should not delete the file the user don't have permission to delete. This would be the best solution in most cases. Know legitimate directories and files, and those which you should not touch.
But now, let's consider the cases when you really need to delete the file protected by the file permissions system. But first, you need to understand UAC:
User Account Control — Wikipedia, the free encyclopedia[
^].
Nothing can break the access protection until the user explicitly gives the system UAC confirmation to elevate the privilege, even if this person already logged on as an administrator; see, for example:
http://4sysops.com/archives/vista%E2%80%99s-uac-8-ways-how-to-elevate-an-application-to-run-it-with-administrator-rights[
^],
Run as Administrator — Windows 7 Help Forums[
^].
The only thing you can additionally do is requesting privilege elevation by your application from the very beginning. To do so, you have to create and embed appropriate
application manifest. This is explained here:
Step 6: Create and Embed an Application Manifest (UAC)[
^].
—SA