Solved

Who is using a file on the network

Posted on 2000-04-03
3
182 Views
Last Modified: 2008-02-20
I want to know, say by selecting a file from a cmdlg, to display a window showing what users have a particualar file open.  I think there might be an API available.

I want this to work on a NT/Windows network.

many thanks
Celo
0
Comment
Question by:celo
  • 2
3 Comments
 

Accepted Solution

by:
monteh earned 100 total points
ID: 2684871
You can use the NetFileGetInfo function but it is tricky.

There are limitations. That is, it will only work for NT machines, and only if the file was opened using the shared resource. If the file was opened via "c:\program files\my program\readme.txt" then it won't work.
0
 

Author Comment

by:celo
ID: 2685538
Will if work on machines running win95 accessing files on the network, if so an you supply an example
0
 

Expert Comment

by:monteh
ID: 2685608
Actually, the function is NetFileEnum, and yes it will work for NT and Win9X but you need to handle the differences.

The MSDN documents the NT version but not the Win9X version. You need to review the header file for the Win9X version (see svrapi.h). The Win9X version is exported in SVRAPI.DLL  while the NT version is exported in NETAPI32.DLL.

There's a sample of the NetFileEnum function (NT version only) on my website (see the Grab Bag page).

http://KillerVB.Com


Monte Hansen
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now