Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IsUserAnAdmin
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Divers
Thread ID:
01175372
Message ID:
01176106
Vues:
14
>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform