Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start Word and monitor if document closed

we need for our school project a way to start a word instance and track if the document was closed. The COM api from word doens't have a event for this, are there any other ways to do this?

Currently we're using the COM api from word, but everything else would be fine. We're programing in C#.

like image 764
MBulli Avatar asked Oct 11 '22 16:10

MBulli


1 Answers

Use the winword process to check if process running on particual file is exited or not.

If you dont know the process of newly started instance use this or simply hook exited event of process.

Get all word processes

var info = Process.GetProcessesByName("winword").FirstOrDefault();

Identify the process of particular file using Process.MainWindowTitle

Hook exited event of the process Process.Exited

like image 78
hungryMind Avatar answered Nov 04 '22 01:11

hungryMind