Hi Hungnn,
As far as I know, your code sinppet is just for checking whether the current application is running as Administrator, but not checking whether UAC is ON/OFF.
If you enable UAC, the application will run in different levels :User/Adiministrator, you can use Run as Administrator elevating User to Adiministrator, so you will get true or false. But if you disable UAC, it will return one state: User or Administrator.
If you want to check for UAC by application, as far as I know, UAC by design is difficult to check for. We don’t want applications checking for it and acting differently. We want applications to act properly with UAC turned on.
And I highly suggest you post your question in appropriate forum, and you will get better answer.
Best Regards,
Nancy
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.