Require Administrator Privileges ( VB6.,0 )

Posted on 2009-12-23
Last Modified: 2012-05-08
I have an application made in visual basic v6.0 .. i am curious to know if there is any way to add a rule to the software so it will require admin privileges so it can run..

Any easy way to do this?
Question by:Carol2009
    LVL 42

    Expert Comment

    u can add a validation code in your app to check the user who runs the app.
    if he's not a domain admin or local admin, notify and close the app.
    LVL 42

    Accepted Solution

    here's a code snippet:
    Private Declare Function IsNTAdmin Lib "advpack.dll" (ByVal dwReserved As Long, ByRef lpdwReserved _ As Long) As Long
    Private Sub Form_Load()
    Debug.Print "Are you an Administrator? " & CBool(IsNTAdmin(ByVal 0&, ByVal 0&))
    End Sub

    Open in new window

    LVL 10

    Expert Comment

    Nice post from egl1044 (second post in question) on how to retrieve if the user has admin rights without asking the user,

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
    Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now