We take pride in your success. We let our positivity drive us, day in and out. Talk to us at Mindfire to know us more.

Software Technology Tips

Usually due to higher security settings in Windows VISTA ,Windows 7 machines we often need to run our application / setup exe by right clicking on the file and using [Run as Administrator] option.
But it can done programmatically too. The sample code given below demonstrates it. 
[VB.NET CODE STARTS]
 
  Dim procInfo As New ProcessStartInfo()
 
  procInfo.WindowStyle = ProcessWindowStyle.Hidden
  procInfo.UseShellExecute = True
  procInfo.FileName = My.Application.Info.DirectoryPath & "\MYInstaller\setup.exe"
  procInfo.WorkingDirectory = ""
 
  If (My.Computer.Info.OSFullName.ToString.Contains("Vista") = True) Or _
               (My.Computer.Info.OSFullName.ToString.Contains("Windows 7") = True) Then

      procInfo.Verb = "runas" 

  End If
 
 Process.Start(procInfo)
 
[VB.NET CODE ENDS]


Related Tags:

VB.NET, Vista, Windows 7, Privilege

Author: Amrita Dash

top

VB.NET

Let us Connect!

privacy

copyright (c) Mindfire Solutions 2007-2012. Login