How do I check if my program is ran by user as administrator (Vista/Win7, C++) [duplicate]
问题 This question already has answers here : Detect if program is running with full administrator rights (2 answers) Closed 2 years ago . I saw IsInRole method but I can't find information on how to use it with C++. 回答1: There's a C++ code snippet in this old answer taken from the UACHelpers project on CodePlex. 回答2: This code solves your problem. Feel free to use it. It works with SE_GROUP_USE_FOR_DENY_ONLY. /** IsGroupMember determines if the current thread or process has a token that contais a