How can I make executeShell ask for Admin Elevation?
    Marcone 
    marcone at email.com
       
    Mon Jul 13 19:32:33 UTC 2020
    
    
  
On Monday, 13 July 2020 at 12:28:24 UTC, aberba wrote:
> On Monday, 13 July 2020 at 00:57:02 UTC, Marcone wrote:
>> On Sunday, 12 July 2020 at 02:10:11 UTC, Marcone wrote:
>>> I don't want start program with admin elevation, but ask user 
>>> for admin permission when some function is called.
>>
>> alias runas = compose!(x => to!bool((cast(int) x) > 32), x => 
>> ShellExecute(null, "runas", "cmd", cast(wchar*) "/c \"cd /d %s 
>> && %s\"".format(getcwd(), x).to!wstring, null, 
>> SW_HIDE).WaitForSingleObject(WAIT_TIMEOUT));
>>
>> runas("netsh winhttp set proxy 127.0.0.1:9666")
>
> Can you put it into a small dub package?
I do not know how to do that. Observation: Remove the code 
.WaitForSingleObject (WAIT_TIMEOUT)
    
    
More information about the Digitalmars-d-learn
mailing list