PC Review


Reply
Thread Tools Rate Thread

Detecting File State

 
 
Roger
Guest
Posts: n/a
 
      23rd Mar 2005
> I'm looking for a way to detect if another process has a file open before
a

Make certain you know it exists, then,
Try to open the file exclusively,
an error means it is in use.
Good day,
Roger


 
Reply With Quote
 
 
 
 
Michael Kellogg
Guest
Posts: n/a
 
      23rd Mar 2005
"Roger" <(E-Mail Removed)> wrote:

>> I'm looking for a way to detect if another process has a file open
>> before a

>
> Make certain you know it exists, then,
> Try to open the file exclusively,
> an error means it is in use.


I'm not proposing a better solution, but I'm pretty sure using error-
trapping or exception handling to test for a thoroughly possible condition
like this would not qualify as a "best practice"...

--
Michael Kellogg
 
Reply With Quote
 
glen
Guest
Posts: n/a
 
      23rd Mar 2005
I'm looking for a way to detect if another process has a file open before a
second process tries to open it. I've looked into the FileAttr function but
I'm not sure if detecting a read-only state is sufficient. Can anyone
confirm or deny? TIA...


 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      24th Mar 2005
Glen,

This is endless asked, however this is as long as there are the MS-dos
operating systems and its successors not possible when you don't create a
special management tool around it, as probably in Office is done.

Cor


 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      24th Mar 2005
glen,

Answers on this are

do while loop condition = false
Try
Open a file
When found leave set the condition to true
Catch
threading.thread.sleep(1000)
'And set a max if you want
End

I hope this helps something

Cor


 
Reply With Quote
 
glen
Guest
Posts: n/a
 
      24th Mar 2005
I have to agree. I'm thinking there must be a way to test the state of the
file for this condition. I just haven't found anything yet...

"Michael Kellogg" <(E-Mail Removed)> wrote in message
news:Xns96228D5919534mkelloggWEDELIVERcc3@207.46.248.16...
> "Roger" <(E-Mail Removed)> wrote:
>
>>> I'm looking for a way to detect if another process has a file open
>>> before a

>>
>> Make certain you know it exists, then,
>> Try to open the file exclusively,
>> an error means it is in use.

>
> I'm not proposing a better solution, but I'm pretty sure using error-
> trapping or exception handling to test for a thoroughly possible condition
> like this would not qualify as a "best practice"...
>
> --
> Michael Kellogg



 
Reply With Quote
 
glen
Guest
Posts: n/a
 
      24th Mar 2005
It's 'The eternal question', then...

"Cor Ligthert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Glen,
>
> This is endless asked, however this is as long as there are the MS-dos
> operating systems and its successors not possible when you don't create a
> special management tool around it, as probably in Office is done.
>
> Cor
>



 
Reply With Quote
 
glen
Guest
Posts: n/a
 
      24th Mar 2005
Interesting....I'll try that. Thanks.

"Cor Ligthert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> glen,
>
> Answers on this are
>
> do while loop condition = false
> Try
> Open a file
> When found leave set the condition to true
> Catch
> threading.thread.sleep(1000)
> 'And set a max if you want
> End
>
> I hope this helps something
>
> Cor
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Detecting view state =?Utf-8?B?S2FtcmFu?= Microsoft Word Document Management 2 28th Jan 2005 02:29 PM
Detecting the ScreenSaver State =?Utf-8?B?QW50aG9ueQ==?= Microsoft C# .NET 2 27th Jan 2005 07:01 PM
detecting the state of filters Chris Spencer Microsoft Excel Programming 2 21st Oct 2003 01:40 AM
Detecting Calculation State Chris Gorham Microsoft Excel Programming 3 15th Jul 2003 11:40 AM
Detecting logon state Greg Miskin Microsoft Dot NET 0 14th Jul 2003 07:20 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:43 AM.