Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open? Using ADSI to tell if a file is open? Using ADSI to tell if a file is open? Using ADSI to tell if a file is open? Using ADSI to tell if a file is open? Using ADSI to tell if a file is open? Using ADSI to tell if a file is open? Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open? Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open?
Go Back  Xtreme Visual Basic Talk > > > Using ADSI to tell if a file is open?


Reply
 
Thread Tools Display Modes
  #1  
Old 12-19-2003, 06:13 PM
domiflichi's Avatar
domiflichi domiflichi is offline
Centurion
 
Join Date: Nov 2003
Location: CA
Posts: 114
Question Using ADSI to tell if a file is open?


Hello all. I am very new to programming so please bear with me. I also have searched the forums about checking to see if a file is open or not, and haven't found any solid answers...so I apologize if this has already been asked/answered. In my specific situation, I have a few Win2k workstations that access a central .pst file that is sitting on a Win2k server (one at a time of course). I was wondering, 1. Is there any good way to tell if a .pst file is already open?, and 2. If not, how about using ADSI? - is there a way to go through the Computer Management program in Shared Folders, then in Open Files? Because when someone has the .pst open, it shows up there. I know you can use ADSI to do other things, but haven't found anything on this yet. What I am doing is trying to write a program that uses SocketWrench/communications that will reside on the server and clients, and the server will constantly check the status of the open file and send a flag to the clients indicating whether the file is already open or not that way they know if they can attempt to open it or not.

Thank you everyone for your patience and help in advance, and I think this forum is great!

I'm sorry I put this here...I meant to put in VB6.
Reply With Quote
  #2  
Old 12-22-2003, 10:12 AM
y2ksw y2ksw is offline
Newcomer
 
Join Date: Apr 2003
Location: Bologna, Italy
Posts: 12
Default

Code:
On Error Resume Next 'Open for exclusive rights Open lpszFileName For Binary Access Read Write Lock Read Write As #1 If Err.Number Then 'Open by other process Else Close #1 End If

Notes: If the file doesn't exist, it will be created and locked. Opening a file in locked mode is sometimes much slower than the shared mode, especially over network access. Using this method allows to create semaphores which are closed automatically when the issuer program closes or crashes; this is very handy where other semaphores might not work, such as mutex over the network with different OS'es.
__________________
Y2K Software Forums
Reply With Quote
  #3  
Old 12-24-2003, 11:51 AM
domiflichi's Avatar
domiflichi domiflichi is offline
Centurion
 
Join Date: Nov 2003
Location: CA
Posts: 114
Default

Awesome! Thanks so much!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
File I/O GavinO Tutors' Corner 5 04-17-2013 02:18 PM
Installation Problem - PLs help urgenlty dpdsouza Installation / Documentation 4 12-02-2004 08:09 PM
Makin a nice little program! Decontain Communications 3 04-11-2003 03:54 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open? Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open? Using ADSI to tell if a file is open? Using ADSI to tell if a file is open? Using ADSI to tell if a file is open? Using ADSI to tell if a file is open? Using ADSI to tell if a file is open? Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open?
 
Using ADSI to tell if a file is open?
Using ADSI to tell if a file is open?
 
-->