I have an application that responds to push notifications, it's function is not open and close documents. it does this by tracking a mix of write locks and process id. the challenge I am facing is when more than 1 Word or Excel file are open, MS merges each open document in to a single process id, so the result is when a request to close 1 document all close. We have our own document editor for some file type as we use PostMessage with the document path to close a single instance, does anyone know if MS Office supports closing a single open document using PostMessage or SendMessage?
Asked
Active
Viewed 130 times
0
-
The Process is the same, but each Window has its own handle (and Caption). `EnumThreadWindows` can find it (using the Process.Threads as source). `FindWindowEx` also. And UI Automation. You can also keep track of these Windows as they pop-up (and get destroyed). – Jimi Feb 19 '21 at 19:41
-
Attaching an interop `Word.Application` and accessing the already opened document via interop might work. Here is the idea (but for Excel): https://stackoverflow.com/questions/6686886/how-to-access-an-already-opened-excel-file-in-c – Loathing Feb 19 '21 at 21:48