I thought about using a loader, but when it's a matter of compiled programs without AutoHotkey installed on the machine, this solution doesn't seem elegant since it requires two separate programs running at the same time.
Here is another working, compromise solution, allowing to toggle between two modes:
Code:
#a:: ; Adjust Privileges
If A_IsAdmin
{
Send, #r
WinWait, Run ahk_class #32770,, 2
If ErrorLevel
Exit
ControlSetText, Edit1, %A_ScriptFullPath%, Run ahk_class #32770
Send, {ENTER}
ExitApp
}
Else
{
PARAM1 = %1%
DllCall("shell32\ShellExecuteA", uint, 0, str, "RunAs", str, A_ScriptFullPath, str, """" . PARAM1 . """", str, A_WorkingDir, int, 1)
}
Return
Is there any way, please, of calling an invisible Run box?