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)
http://msdn.microsoft.com/en-us/library/windows/desktop/aa376389%28v=vs.85%29.aspx

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

Andy

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)
http://msdn.microsoft.com/en-gb/library/windows/desktop/bb776463%28v=vs.85%29.aspx
Last edited on
Topic archived. No new replies allowed.