Von normalem Programm administratives öffnen

brunlorenz

*C* & Windows-Freak
Hallo,
Ich habe ein Programm im normalen Modus, das per ShellExecute ein Programm mit administrativen Rechten aufrufen sollte (UAC).
Er führt das Programmm nicht aus!
Kann mir jemand helfen?
 
Das geht mit dem seit XP eingeführten "runas" als Verb:

SHELLEXECUTEINFO shExecInfo;

shExecInfo.cbSize = sizeof( SHELLEXECUTEINFO );
shExecInfo.fMask = NULL;
shExecInfo.hwnd = m_hWnd;
shExecInfo.lpVerb = "runas";
shExecInfo.lpFile = "grworker.exe";
shExecInfo.lpParameters = Params.c_str();
shExecInfo.lpDirectory = TempPath;
shExecInfo.nShow = SW_SHOW;
shExecInfo.hInstApp = NULL;

Die aufgerufene .exe muss ein Manifest mit runAsAdmin haben.
 
Zurück