Several users of my visual basic 6 application must "run as administrator" Others, do not and can just double click.
Is there a code that I can add as the program opens to check if Run As Aministrator is necessary and then open a window to indicate this?
You will need to use an API to determine if the current user has administrative rights or not.
Luckily, there is one function that returns
0
forFalse
to indicate the status of the current user. Namely: IsUserAnAdminHere is how to declare it and use it:
Then in your
Form_Load()
Note: The Shell function
IsUserAnAdmin
is depricated. You can replace the functionality with something like (pseudocode):