Simple Question: Is there a way to only ask for administrative privileges if you run the application on Windows 8?
The only method I saw so far is calling an external program to kill and reopen it with admin privileges, if it is on Windows 8. By external program I mean a vb script for example.
But this method is really unsafe and kind of dirty.
I'm asking because on Windows 8 there are a lot of little things that you can't do anymore without admin rights. Like write/delete files in the program files folders and accessing/manipulating other processes that have admin rights.
To the best of my knowledge, there is no way for a process running without an elevated token to become elevated. It can launch a new process elevated using ShellExecute with the "runas" verb (see http://blogs.msdn.com/b/vistacompatteam/archive/2006/09/25/771232.aspx ). Of course a UAC prompt will show. If you really want to detect Windows 8 and only have the UAC prompt come up there and not on Windows 7, you can write a wrapper over your main application which launches your main application with UAC prompt on Win8.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.