Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
IsUserAnAdmin
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Title:
Miscellaneous
Thread ID:
01175372
Message ID:
01176106
Views:
13
>This API function works just fine under XP SP2, but under 2000 SP4 the system is unable to find an entry point for this function.
>
>How does one check if the current user has administrative rights in a Win2K environment?
>
>Laterness,
>Jon

In addition to the other replies. I use this. It only works in VFP 7.0 or greater, do to the GetObject() function
? ATC("Administrators", localgroups())>0

    PROCEDURE LocalGroups
        LOCAL strComputer, objWMIService, colItems, objItem, lcResult

        lcResult = ""
        #IF VERSION(5)>600
            strComputer = "."
            objWMIService = GETOBJECT( "winmgmts:\\" + strComputer + "\root\cimv2")
            colItems = objWMIService.ExecQuery("Select * from Win32_Group  Where LocalAccount = True")
            lcResult = crlf
            IF NOT TYPE("colItems.Count")=="O"
                FOR EACH objItem IN colItems
                    lcResult = lcResult + TRANSFORM(objItem.NAME) + crlf
                NEXT
            ENDIF
        #ENDIF
        RETURN lcResult
    ENDPROC
Greg Reichert
Previous
Reply
Map
View

Click here to load this message in the networking platform