Autor Beitrag
jg72
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 22



BeitragVerfasst: Di 15.11.11 16:22 
Hallo Zusammen,

ich benutze folgenden Code, um ein Dokument (Word, Excel, PDF, ...) zu öffnen:
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
Process procStart = Process.Start(sFile); //sFile = "Test.Doc"
if (bWait)
{
    procStart.WaitForInputIdle();
    procStart.WaitForExit();
}

Dabei soll gewartet werden, bis das Dokument (bzw. das Programm) wieder geschlossen wird, um festzustellen, ob das Dokument geändert wurde.

Meist funktioniert dies auch ohne Probleme. Leider liefert aber Process.Start null zurück, wenn schon eine Instanz des verknüpften Programmes(Word) geöffnet ist.

Hat irgend jemand eine Idee, wie man dieses sauber lösen kann?

Gruß,
Jürgen

Moderiert von user profile iconChristian S.: Code- durch C#-Tags ersetzt
ujr
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 102
Erhaltene Danke: 12



BeitragVerfasst: Mi 16.11.11 18:54 
Hallo,

schau Dir mal die FileSystemWatcher-Klasse an.