If access to some file system object is denied, you cannot fix its access by some application via any manipulations inside this application. Just think about it: if UAC (
http://en.wikipedia.org/wiki/User_Account_Control[
^], read about it thoroughly) could be worked around, why would anyone create and use it?
You can only elevate privilege for your application run your application "As Administrator", or use elevation of your privileges to modify the access to the file system object in question. Please see:
http://www.sevenforums.com/tutorials/11841-run-administrator.html[
^].
Alternatively, you can create an embed the application manifest, to force elevation automatically, from the very beginning:
http://msdn.microsoft.com/en-us/library/bb756929.aspx[
^].
No, it won't bypass the UAC dialog. :-)
—SA