QB64.org Forum
Active Forums => QB64 Discussion => Topic started by: hanness on April 10, 2019, 01:25:56 am
-
I have a QB64 program on Windows that runs a lot of Windows commands via the "SHELL" command. Some of these need to be run with elevated permissions. If I right-click on my QB64 program and choose "Run as administrator" everything works flawlessly, otherwise, it will not.
Is there a way that I can do a check from within a QB64 program to see if the program was run elevated or not? The idea would be that I would display a message to a user if it was not run elevated and then exit the program.
Thanks!
-
QB64 does support Windows API functions, but you would need to figure out how to address the library, properly. I've only struggled with four or five of those in the past. All successful, but I just don't have a knack for it yet. Anyway, someone else may know that method, or have another way around it.
http://www.qb64.org/wiki/Windows_Libraries
It might be workable with this: https://www.codeproject.com/articles/317695/detecting-if-an-application-is-running-as-an-eleva
Welcome to the forum.
Pete
-
I use this:
cmd$
= ">nul 2>&1 " + CHR$(34) + "%SYSTEMROOT%\system32\cacls.exe" + CHR$(34) + " " + CHR$(34) + "%SYSTEMROOT%\system32\config\system" + CHR$(34) PRINT "please run as administrator."
-
Thanks very much for the help.