Bonjour,
Lord de l’exécution de mon programme, celui-ci doit écrire ds la base de registre.
Si l'UAC est désactivée tout ce passe bien à l'inverse, j'ai une fenêtre d'autorisation qui apparait.
J'utilise cette procédure qui permet normalement d’exécuter en tant qu'administrateur :
Mais ça ne marche pas, la fenêtre d'autorisation apparait toujours !!!
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 Private Sub AdminUACProcess(ByVal arg As String) Dim process As System.Diagnostics.Process = Nothing Dim processStartInfo As System.Diagnostics.ProcessStartInfo processStartInfo = New System.Diagnostics.ProcessStartInfo() processStartInfo.FileName = "regedit.exe" If System.Environment.OSVersion.Version.Major >= 6 Then ' Windows Vista or higher processStartInfo.Verb = "runas" Else ' No need to prompt to run as admin End If processStartInfo.Arguments = arg processStartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal processStartInfo.UseShellExecute = True Try process = System.Diagnostics.Process.Start(processStartInfo) Catch ex As Exception MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) Finally If Not (process Is Nothing) Then process.Dispose() End If End Try End Sub
Si quelqu'un pouvait m’éclairer sur où est mon erreur...
Merci.
Partager