Support Forums

Full Version: {TuToRiAl} How To Verify If Your App. Was Ran As Administrator {TuToRiAl}
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hello there. Today I shall be teaching you how to verify if your application had been ran as an administrator with administrator privileges all in a few easy lines of code.

So allow me to demonstrate:

Get Your Project Ready.

Then make a label named Status

Then have a button.

Double click the button and use this code:
Code:
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If My.User.IsInRole(ApplicationServices.BuiltInRole.Administrator) Then
            Status.Text = "Yes, I am the big boss."
        Else
            Status.Text = "No, maybe next time."
        End If
    End Sub
End Class

Here is a little animation for you guys below to show some results:
[Image: 9XJfI.gif]

Enjoy and don't forget to say thanks if this helps.
Nice example! Could be useful in things like auto-updating.

Can I ask sth irrelevant? How do you create the animation?
(04-21-2011, 12:32 AM)thanasis2028 Wrote: [ -> ]Nice example! Could be useful in things like auto-updating.

Can I ask sth irrelevant? How do you create the animation?

Camtasia studio, output as gif instead of movie.
(04-21-2011, 01:39 AM)Infinity Wrote: [ -> ]Camtasia studio, output as gif instead of movie.

I already sent him a private message Infinity. Right now I am going to make a tutorial on that whole process and post the thread here. I believe people will find it somewhat helpful.
(04-21-2011, 10:36 AM)The High Roller Wrote: [ -> ]I already sent him a private message Infinity. Right now I am going to make a tutorial on that whole process and post the thread here. I believe people will find it somewhat helpful.

I'd rather just make videos, but I know of other people that use gifs instead like you have. And you never know, maybe I posted it before you sent him the private message lol. You didn't notice until today that I gave him a method of making the gif as well.
(04-21-2011, 02:38 PM)Infinity Wrote: [ -> ]I'd rather just make videos, but I know of other people that use gifs instead like you have. And you never know, maybe I posted it before you sent him the private message lol. You didn't notice until today that I gave him a method of making the gif as well.

Listen, the second I got the email notification I started hitting him up a PM. Impossible you beat me to it Big Grin no lie.
(04-21-2011, 06:06 PM)The High Roller Wrote: [ -> ]Listen, the second I got the email notification I started hitting him up a PM. Impossible you beat me to it Big Grin no lie.

I don't know, i'm pretty fast with responses lol Smile But if you did it the within the first 10 minutes of that comment, then you beat me. I don't like using that personally because it's not as high quality as a video, and you can't have control over what part of the 'animation' you view with a gif.

Back on topic though, this would be useful for a few things i've noticed.
Wow, I didn't even know you could do this.
Thanks a lot, definitely adding some 'Run as admin.' screensSmile
(09-03-2011, 05:30 AM).edit Wrote: [ -> ]Wow, I didn't even know you could do this.
Thanks a lot, definitely adding some 'Run as admin.' screensSmile

ofc we could do this, Thanks O.P. for making this...
I've never tried this before. I'll be trying this out pretty soon. Thanks for sharing it.
Pages: 1 2