Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to tests whether the current user is a member of the Administrator's group ?

How to tests whether the current user is a member of the Administrator's group ?

Scheduled Pinned Locked Moved Visual Basic
jsontutorialquestionannouncement
3 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    Ky Nam
    wrote on last edited by
    #1

    I currently use IsUserAnAdmin() api function , MSDN : Minimum DLL Version shell32.dll version 5.0 or later Custom Implementation No Header shlobj.h Import library shell32.lib Minimum operating systems Windows 2000 But many users reported this function doesn't exist in Windows 2000 How to tests whether the current user is an admin ? Thank you

    D 1 Reply Last reply
    0
    • K Ky Nam

      I currently use IsUserAnAdmin() api function , MSDN : Minimum DLL Version shell32.dll version 5.0 or later Custom Implementation No Header shlobj.h Import library shell32.lib Minimum operating systems Windows 2000 But many users reported this function doesn't exist in Windows 2000 How to tests whether the current user is an admin ? Thank you

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      It does exist, it's just not exported by name. According to the export list of Shell32.dll on Windows XP, IsUserAnAdmin is ordinal #680 (decimal). The oridnal number should not change between versions, so it should be the same in the Windows 2000 version. So, in order to use it in Windows 2000, you have to specify the function's ordinal number instead of its name. If I remember correctly, its Declare looks like this:

      Declare Function IsUserAnAdmin Lib "shell32.dll" Alias "#680" () As Boolean

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      K 1 Reply Last reply
      0
      • D Dave Kreskowiak

        It does exist, it's just not exported by name. According to the export list of Shell32.dll on Windows XP, IsUserAnAdmin is ordinal #680 (decimal). The oridnal number should not change between versions, so it should be the same in the Windows 2000 version. So, in order to use it in Windows 2000, you have to specify the function's ordinal number instead of its name. If I remember correctly, its Declare looks like this:

        Declare Function IsUserAnAdmin Lib "shell32.dll" Alias "#680" () As Boolean

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        K Offline
        K Offline
        Ky Nam
        wrote on last edited by
        #3

        Thank you

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups