private void OnBeforeQueryStatusGroup(object sender, EventArgs e) { // I don't need this next line since this is a lambda. // But I just wanted to show that sender is the OleMenuCommand. OleMenuCommand item = (OleMenuCommand)sender; if (ElevationChecker.CanCheckElevation) { item.Visible = !ElevationChecker.IsElevated(Process.GetCurrentProcess().Handle); } }
public static extern bool GetTokenInformation(IntPtr tokenHandle, ElevationChecker.TokenInformation info, ref IntPtr tokenInformation, int tokenInformationLength, out uint returnLength);