How to see if Admin or Not windows 7

closed account (ozUkoG1T)
Hi C++ forums,
I am currently working on a program which finds if you are Admin or not if you are Admin it will pop a Window saying You are a Admin and else it says You are Not a Admin.

Can anyone here help please
This MSDN entry has the code for the preferred method:

CheckTokenMembership function (Windows)

(There's example code for a function called IsUserAdmin, but also see the community feedback)


PS The Shell API (include Shlobj.h, link to Shell32.lib) does have a call IsUserAnAdmin, but this is deprecated. To quote MSDN

This function is a wrapper for CheckTokenMembership. It is recommended to call that function directly to determine Administrator group status rather than calling IsUserAnAdmin.

IsUserAnAdmin function (Windows)
Last edited on
Topic archived. No new replies allowed.