Re: Determining whether a document is open
From: Chris Morgan (chris.nospam)
Date: 01/07/04
- Next message: Jens Gruschel: "Re: Design Time Conditions?"
- Previous message: Mark Vaughan: "Re: arrays manipulation unit?"
- In reply to: phwip: "Re: Determining whether a document is open"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 7 Jan 2004 13:19:39 -0000
> Thanks Chris. The code worked great, and suprisingly it does
actually work
> for MS Word and Excel (2000). Unfortunately it does not work for
text files
> opened in Notepad. I guess this is probably due to the problem Iain
> Macmillan described where the app closes the disk file after loading
it into
> memory. I haven't yet tested any other apps except Word, Excel and
Notepad.
> Does anybody know of any way of determining whether a file is opened
in an
> app like Notepad, or is this simply impossible?
Glad it helped.
I doubt there is any comprehensive method that will work for all
applications.
You could try using the Window handle of Notepad and checking if the
start of
the window caption is the same as the file name, but this is really
dodgy,
and wouldn't work for programs like Internet Explorer, or other text
editors
which don't display the filename as the first part of the caption.
I think you may have to do a combination of checking whether you can
open the
file in Exclusive mode, and using WaitForSingleObject (or whatever) to
signal
when the application you called in ShellExecute terminates.
Cheers,
Chris
- Next message: Jens Gruschel: "Re: Design Time Conditions?"
- Previous message: Mark Vaughan: "Re: arrays manipulation unit?"
- In reply to: phwip: "Re: Determining whether a document is open"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|