Admin or not

BlitzPlus Forums/BlitzPlus Programming/Admin or not

mattm591(Posted 2004) [#1]
I am trying to create a very simple (in theory) program. All I want it to do is check if the person logged onto the computer is an administrator or not. If their not then display a message, and if they are open a program. Can anyone help?

Thanks

Matt


Wiebo(Posted 2004) [#2]
You can't do this in Blitz. You can create a vbscript for it though...


xlsior(Posted 2004) [#3]
Actually, the following code will do exactly that:

If CallDLL("shell32.dll","IsUserAnAdmin") Then 
Notify "User is Administrator"
;file operation code in here 
Else 
RuntimeError "You need to do this from an admin account!" 
EndIf 


courtesy of Electronin, posted a while back in the following thread: http://www.blitzbasic.com/Community/posts.php?topic=31698


Wiebo(Posted 2004) [#4]
Now that is pretty cool, and a very good tip! Thanks xlsior. Is there a list of more functions in that DLL?
Before runnning this code, the program should ofcourse check on which OS it is running.


soja(Posted 2004) [#5]
From version 6.0.2800.1233 of shell32.dll:



Wiebo(Posted 2004) [#6]
cool :)


mattm591(Posted 2004) [#7]
Thanks. Thats great!