Registriert seit: 1. Feb 2018
3.691 Beiträge
Delphi 11 Alexandria
|
AW: Passwort automatisch eingeben
10. Aug 2020, 14:09
Meinst Du so etwas?
Delphi-Quellcode:
procedure RunAsExec(hWnd: HWND; aFile: string; aParameters: string);
var
SEI: TShellExecuteInfo;
begin
FillChar(SEI, SizeOf(SEI), 0);
SEI.cbSize := sizeof(SEI);
SEI.Wnd := hWnd;
SEI.fMask := SEE_MASK_NOCLOSEPROCESS;
SEI.lpVerb := 'runas';
SEI.lpFile := PChar(aFile);
SEI.lpParameters := PChar(aParameters);
SEI.nShow := SW_SHOWNORMAL;
if not ShellExecuteEx(@SEI) then
RaiseLastOSError;
end;
Beispiel-Aufruf:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
DateiName: string;
Parameter: string;
begin
DateiName := 'Programm.exe';
Parameter := ' ' + 'Benutzername' + ' ' + 'Passwort';
RunAsExec(Application.Handle, DateiName, Parameter);
end;
|
|
Zitat
|