Hi Forum, I need a little help with the code.
My application includes a lot of third party executables, they are simple application for my pupils.
Often I have some problem with UAC, Administrator Rights and similar.
I tried "Require Administrator" and other option in my application but no changes.
So I created a button with this code
It simply shows the UAC panel.
Now I would avoid this option and insert to buttons that directly Enable or Disable the User Account Control.
I found a way using bath files. By using Shell.Execute, I launch the BAT file, reboot Windows and it works perfectly. But I d0n't like this kind of solution and I would to launch the BAT code directly from a button.
I found two codes to change UAC status:
Enable UAC
%SYSTEMDRIVE%\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Pol icies\System /v EnableLUA /t REG_DWORD /d 1 /f
Disable UAC
%SYSTEMDRIVE%\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Pol icies\System /v EnableLUA /t REG_DWORD /d 0 /f
Well I tried for five days to execute them with Shell.Execute and File.Run without success. I'm in trouble wit executables, arguments and more.
Please Forum, suggest me the right way to launch this code, possibly with Shell.Execute.
As usual, THANKS.
My application includes a lot of third party executables, they are simple application for my pupils.
Often I have some problem with UAC, Administrator Rights and similar.
I tried "Require Administrator" and other option in my application but no changes.
So I created a button with this code
Code:
result = Shell.Execute("UserAccountControlSettings.exe", "open", "", "", SW_SHOWNORMAL, false);
Now I would avoid this option and insert to buttons that directly Enable or Disable the User Account Control.
I found a way using bath files. By using Shell.Execute, I launch the BAT file, reboot Windows and it works perfectly. But I d0n't like this kind of solution and I would to launch the BAT code directly from a button.
I found two codes to change UAC status:
Enable UAC
%SYSTEMDRIVE%\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Pol icies\System /v EnableLUA /t REG_DWORD /d 1 /f
Disable UAC
%SYSTEMDRIVE%\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Pol icies\System /v EnableLUA /t REG_DWORD /d 0 /f
Well I tried for five days to execute them with Shell.Execute and File.Run without success. I'm in trouble wit executables, arguments and more.
Please Forum, suggest me the right way to launch this code, possibly with Shell.Execute.
As usual, THANKS.
Comment