473,322 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Check wheather other apps have opened a certain file

Hi guys,
just to keep it short and simple - I'd like to "monitor" a file that is
opend in Word e.g. and wait for it to be closed but I didn't find a way
to check the current access state of a file and maybe a list of thread
which are accessing that file. The best way would be to have an event
rising when the file is closed but a simple "every 1 second check
access state" is fine too.
Thanks for your help!

May 22 '06 #1
7 4189
You guys have no idea how to do that ? What about using some c++
functions to get there ? Then this is probably the wrong group to ask
but you may have some ideas anyway.

May 24 '06 #2

"verTex" <Be******************@googlemail.com> wrote in message
news:11**********************@g10g2000cwb.googlegr oups.com...
| You guys have no idea how to do that ? What about using some c++
| functions to get there ? Then this is probably the wrong group to ask
| but you may have some ideas anyway.
|

What makes you think that C++ would be of any help, this is not an issue
that can be solved by one particular language, you would have to call an API
anyway and that's the problem, there is no such API.

Willy.
May 24 '06 #3

<Be******************@googlemail.com> wrote in message
news:11*********************@j55g2000cwa.googlegro ups.com...
| Hi guys,
| just to keep it short and simple - I'd like to "monitor" a file that is
| opend in Word e.g. and wait for it to be closed but I didn't find a way
| to check the current access state of a file and maybe a list of thread
| which are accessing that file. The best way would be to have an event
| rising when the file is closed but a simple "every 1 second check
| access state" is fine too.
| Thanks for your help!
|

All you can do is reputedly open the file and retry after a time-out period
if it fails until it succeeds.

Willy.
May 24 '06 #4
Hi Willy,
Thanks for your response.
Then I probably have to use the brute force way :)

verTex

May 25 '06 #5

"verTex" <Be******************@googlemail.com> wrote in message
news:11********************@j73g2000cwa.googlegrou ps.com...
| Hi Willy,
| Thanks for your response.
| Then I probably have to use the brute force way :)
|
| verTex
|

This is not brute force, this is the only way.

Willy.
May 25 '06 #6
Well, I'm having a problem right now. Just opening a file doesn't throw
any exceptions! And I can open .txt files with various programs at the
same time. Even if I OpenWrite an already opened file, it seems to
work. When does a function fail if the file is already opened ? (or
which)
thanks!

May 28 '06 #7

"verTex" <Be******************@googlemail.com> wrote in message
news:11*********************@u72g2000cwu.googlegro ups.com...
| Well, I'm having a problem right now. Just opening a file doesn't throw
| any exceptions! And I can open .txt files with various programs at the
| same time. Even if I OpenWrite an already opened file, it seems to
| work. When does a function fail if the file is already opened ? (or
| which)
| thanks!
|

And who's the other party? I mean what program has the file open and in what
mode? Also, bear in mind that some programs don't keep the files open while
they run, so you might be lulled into believe that the file is open while
it's not.

Anyway, all depends on "sharing mode", if:
a program (P1) has a file open for exclusive use, any subsequent attempt to
open the file will throw an exception.
If P1 has a file open with shared read access, any subsequent attempt to
open the file in read mode will succeed, while read/write mode will throw.

If P1 has a file open with read/write shared access, other programs will be
allowed to open the file in read and read/write mode.

Willy.
May 28 '06 #8

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

Similar topics

20
by: | last post by:
If I need to check if a certain value does exist in a field, and return either "yes" or "not" which query would be the most effestive?
11
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
1
by: Devhead | last post by:
i have an MS Word Document that i have created from an SQL server db and once created it is opened. If i try to create the same document with the same filename, i get an error. how do i check to...
6
by: Dino Buljubasic | last post by:
My application creates some temporary files that are deleted when my application terminates. However, if a temp file is open, it will not be deleted and application will crash. How can I...
9
by: Dino Buljubasic | last post by:
If I want to delete a file I can call File.Delete(filePath) but what happens if I am trying to delete the file that is open??? In java you would do someting like int status =...
4
by: jes | last post by:
hi, i have an open & delete btn. onclick of open as visio drawing opens in visio & onclick of delete the drawing gets deleted from the filesystem. The problem is i am unable to perform these...
3
by: walterbyrd | last post by:
I am working on a timecard app. When somebody logs in, it stamps his/her time. Problem is, I have to make sure that somebody is not logging in from a remote site. I want all the logins from one...
2
by: sunnysrivastava84 | last post by:
I am using VB6 and i want to check wheather a record is present or not in a table by clicking on the search button,Plz give me the query. the search code is. if tuno.Text = "" Then MsgBox...
6
by: Ros | last post by:
There are 10 files in the folder. I wish to process all the files one by one. But if the files are open or some processing is going on them then I do not want to disturb that process. In that case...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.