06-12-12, 01:10 PM
إستخدم هذا الأمر في حدث Form_Load :
كود :
Dim isElevated As Boolean
Dim identity As Security.Principal.WindowsIdentity = Security.Principal.WindowsIdentity.GetCurrent()
Dim principal As New Security.Principal.WindowsPrincipal(identity)
isElevated = principal.IsInRole(Security.Principal.WindowsBuiltInRole.Administrator)
If Not isElevated Then
If MsgBox("Run as Administrator?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
Dim P As New Process
P.StartInfo = New ProcessStartInfo
P.StartInfo.FileName = Application.ExecutablePath
P.StartInfo.Verb = "runas"
P.Start()
End If
Application.Exit()
End If[SIZE=6]لا إله إلا أنت سبحانك إني كنت من [/SIZE][SIZE=6]الظالمين[/SIZE][SIZE=6]
[/SIZE]
[/SIZE]
