Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Network Stuff

Posted on 1997-11-26
3
Medium Priority
?
172 Views
Last Modified: 2010-04-04
Hi i was wondering,

Is it possilbe with delphi to see witch users are logged in to a station ? (like ms's netwatcher) and how could i disconnect them ? and the last question =) how do i set access rights on directory's ?

Thanx !

Regards, Arijan
0
Comment
Question by:aluiken
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Expert Comment

by:Arjan092097
ID: 1351994
Yes, that's possible! There's only one problem: Delphi does provide a wrapper for the API functions you need (The svrapi.dll in Windows95 and netapi32.dll in WindowsNT).

The functions you need are:

NetShareEnum: enumerates all the shares you've got
NetSessionEnum: enumerates all the (network)-sessions
NetFileEnum: enumerates open files (via network!)

When you use these API functions you will be able to make a program like MS Netwatcher. An example of a Netwatcher source for WindowsNT is available at the Microsoft MSDN homepage.

Disconnecting users works as follows:
NetSessionDel: disconnect the user using that session

I don't know how to set access rights, but I assume there are some functions in the NetApi32.dll like:
NetAccessEnum
NetAccessAdd etc.

I hope this will help.

Arjan
0
 
LVL 1

Author Comment

by:aluiken
ID: 1351995
Do you have a sample source for that (win95?)

Regards, Arijan
0
 

Accepted Solution

by:
Arjan092097 earned 200 total points
ID: 1351996
No, I don't have some sample code. But I think the following will work:

Example for NetShareEnum:
declare NetShareEnum to be external from svrapi.dll

function NetShareEnum(
    LPTSTR servername,      (pointer to string (PChar))
    DWORD level,      
    LPBYTE * bufptr,      (pointer to byte)
    DWORD prefmaxlen,      
    LPDWORD entriesread,(pointer to word)      
    LPDWORD totalentries,      ""
    LPDWORD resume_handle  ):NetApiStatus; external svrapi.dll;

You've to provide a mapping between the types used in Windows API and the ones used by Delphi.

Then it's possible to use the function. To find a description of the function and his parameters you can look in the helpfiles.

Succes,

Arjan
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

722 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