473,473 Members | 1,415 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to detect when the external program closes the file?

Ana
Hi!
I have problems with the following scenario:
My application is developed using C# under .NET. It must run on all Windows
versions starting from Windows 98.
The user must open different documents (txt, MS Office files, pdf,
pictures,…) from inside my app. It must start the file with the adequate
external program (Notepad, MS Office programs, Acrobat Reader, some Picture
viewer,... ) and be notified when this programs closes the document.
I have tried using various algorithms described on the newsgroups, like
using WaitForSingleObject and "Shell and Wait", but the problem is that it
does not work when the program being called is already started.
For example, when Outlook is started, the winword.exe process is running by
default. Opening a MS Word document from inside my app does not start a new
winword.exe process. Instead it just opens my document in a new Word window.
Because of that, starting winword.exe from my app, does not actually start
it, and I can't therefore wait for the process to end or check exit code or
do something similar.
I also tried enumerating the running processes, using
System.Management..ManagementClass methods, but I can’t get the information
about the files that a program has opened, just about it’s related DLLs and
EXEs (process.GetRelated("CIM_DataFile")).

I would like either to be notified when the file is closed or check, by
using some kind of a file handle, if my file is still opened.
Does anybody have a suggestion how to do it?

Thanx, ANA.

Nov 22 '05 #1
0 807

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ana | last post by:
Hi! I have problems with the following scenario: My application is developed using C# under .NET. It must run on all Windows versions starting from Windows 98. The user must open different...
6
by: Kiran | last post by:
Hi, I have program, which opens file at the startup and logs error messages to the file, file handle is closed at the end of the program. However if file is deleted in-between, program do not...
6
by: Ana | last post by:
Hi! I have problems with the following scenario: My application is developed using C# under .NET. It must run on all Windows versions starting from Windows 98. The user must open different...
4
by: nrocha | last post by:
Hello, I've been trying to detect when a user closes a page or navigates away from it. This is part of a solution for locking pages (that is, if a user enters a page, no one else can enter it...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.