![]() |
Wieso startet UAC minimiert?
Hi,
habe eine Funktion die wir in diesem Thread ![]() um eine Anwednung mit Adminrechten zu starten. Szenario: sfx.exe soll setup.exe mit Adminrechten starten. Ergebnis: Auf Vista kommt dann auch die UAC auf...leider aber nur minimiert...ich muss die UAC erst in der Taskleiste anklicken bevor sie den bildschirm abdunkelt und dann nach den bestätigen das Setup startet. Ich will nicht das die UAC minimiert startet! Wie bekomme ich das ordentlich hin? Hier der verwendete Code zum Starten:
Delphi-Quellcode:
function ExecAndWait(Filename, Params: string; WindowState: word = SW_SHOWNORMAL; const AdminMode:Boolean = true): boolean;
var ShExecInfo: SHELLEXECUTEINFO; r : Cardinal; const SEE_MASK_NOASYNC= $100; begin Result := false; if Filename = '' then exit; if not FileExists(FileName) then Begin ShowMessage('Datei "' + Filename + '" nicht existent!'); Exit; End; ZeroMemory(@ShExecInfo, SizeOf(ShExecInfo)); ShExecInfo.Wnd := application.Handle; ShExecInfo.cbSize := sizeof(SHELLEXECUTEINFO); ShExecInfo.fMask := SEE_MASK_NOCLOSEPROCESS or SEE_MASK_NOASYNC; if AdminMode then ShExecInfo.lpVerb := 'runas' else ShExecInfo.lpVerb := 'open'; ShExecInfo.lpFile := PChar(Filename); ShExecInfo.lpParameters := PChar(Params); ShExecInfo.lpDirectory := PChar(ExtractFileDir(Filename)); ShExecInfo.nShow := WindowState; Result := ShellExecuteEx(@ShExecInfo); if Result then begin repeat R := MsgWaitForMultipleObjects(1, ShExecInfo.hProcess, False, INFINITE,QS_ALLINPUT); if r <> WAIT_OBJECT_0 then Application.ProcessMessages; until r = WAIT_OBJECT_0; CloseHandle(ShExecInfo.hProcess); end else Showmessage('Fehler beim Starten der Anwendung:' + Filename + #13#10'System Fehler: ' + SysErrorMessage(GetLastError)); end; |
AW: Wieso startet UAC minimiert?
Hm, das hier war die Lösung...
![]() Diese Zeile ist z uändern gewesen von
Delphi-Quellcode:
auf
ShExecInfo.Wnd := application.handle;
Delphi-Quellcode:
ShExecInfo.Wnd := application.MainFormHandle;
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:21 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz