Am I admin on Win 10 or not?
Posted: Mon Dec 31, 2018 9:14 am
Starting to feel the pain of Win 10 lately... I avoided it as long as possible but finally relented... and now I'm having issues. 
As you can see from the screenshot below, I am logged in to what is apparently an administrator account. (I also have a limited account that I normally log into). But, despite what you see below, I still have to accept UAC prompts to run RegEdit and other such tools, and the code below returns 0 for all three admin tests.
What the heck is going on? How can my app know if it's running with admin rights?


As you can see from the screenshot below, I am logged in to what is apparently an administrator account. (I also have a limited account that I normally log into). But, despite what you see below, I still have to accept UAC prompts to run RegEdit and other such tools, and the code below returns 0 for all three admin tests.
What the heck is going on? How can my app know if it's running with admin rights?
Code: Select all
Procedure IsAdmin()
a=OpenSCManager_(0,0,#SC_MANAGER_ALL_ACCESS)
If a : CloseServiceHandle_(a) : EndIf
ProcedureReturn a
EndProcedure
Debug IsAdmin() ; Returns 0
Debug IsUserAdmin_() ; Returns 0
Debug IsUserAnAdmin_() ; Returns 0
