Autor Beitrag
Smilebey
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 59

Win XP
D7 Ent
BeitragVerfasst: Mo 12.03.07 17:18 
Hallo allerseits,
hab eine Frage zur Ausführung von Exel.exe.
Ich würde gerne aus meiner Applikation die das Programm C:\Programme\Microsoft Office\OFFICE11\EXEL.exe auführen aber als anderer Benutzer z.B. User1 mit Password password1. Wäre gut wenn automatisch dazu noch eine .xls datei "aufmachen" könnte.
Danke im Voraus!
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Mo 12.03.07 17:23 
runas /user:Benutzername excel.exe mappe.xls
Einfach über ShellExecute ausführen. Aber wie das mit einem Passwort geregelt wird, keine Ahnung. Gib mal an der Eingabeaufforderung runas ein.

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell
Smilebey Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 59

Win XP
D7 Ent
BeitragVerfasst: Mo 12.03.07 17:58 
Titel: Danke
Super,danke für die schnelle Antwort.
Es hat geklappt. Das Password fordert er, über cmd.exe. Sieht nicht gerade elegant aus einer Applikation in ein ms-dos Fenster das Password einzugeben, aber was solls. Ich hab versucht noch z.B. /password:password1 in die Command Line einzubringen aber es kommen nur Fehlermeldungen. Wenn jemand noch ne Lösung hat wo das Password schon in meinem Programm abgefragt wird und nicht erst im CMD.exe Fenster würde mir das sehr weiter helfen. Danke!
Narses
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Administrator
Beiträge: 10185
Erhaltene Danke: 1261

W11x64
TP3 .. D7pro .. D10.2CE
BeitragVerfasst: Mo 12.03.07 18:08 
Moin!

Guckst du: Suche in: Delphi-Forum, Delphi-Library CREATEPROCESSASUSER

cu
Narses

_________________
There are 10 types of people - those who understand binary and those who don´t.
Smilebey Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 59

Win XP
D7 Ent
BeitragVerfasst: Mo 12.03.07 20:59 
Irgendwie schaff ich es nicht die runas command line in die ShellExecute Funktion reinzukriegen. Könnte vielleicht jemand diese Commandline in die Funktion einfügen?

runas /user:user1 "C:\Programme\Microsoft Office\Programm1.exe mappe.xls"
Timosch
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 1314

Debian Squeeze, Win 7 Prof.
D7 Pers
BeitragVerfasst: Di 13.03.07 17:50 
Nimm Narses' Methode, die ist wesentlich besser.
Wenns dich dennoch interessiert:
ausblenden Quelltext
1:
ShellExecute(0, PChar('open'), PChar('runas.exe'), PChar('/user:user1 "C:\Programme\Microsoft Office\Programm1.exe mappe.xls"'), PChar(Sysdir), SW_SHOW);					

Sysdir auf den Pfad zum Systemverzeichnis setzen (z.B. C:\Windows\System32).

_________________
If liberty means anything at all, it means the right to tell people what they do not want to hear. - George Orwell