Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET
Go Back  Xtreme Visual Basic Talk > > > Shared Folder Monitor in VB.NET


Reply
 
Thread Tools Display Modes
  #1  
Old 06-26-2011, 02:35 AM
menglim menglim is offline
Newcomer
 
Join Date: Jun 2011
Posts: 3
Default Shared Folder Monitor in VB.NET


I need your help.
Can you give me a function or class which have properties ?
For example:


I shared a folder (C:\shared)

Dim clsObj as new clsSharedMonitor("C:\shared")
'so that I can get its properties like:
clsObj.FullPath() 'Full Path of folder that client are accessing
clsObj.ClientIP() 'IP of computer which access to server
clsObj.UserName() 'UserName of client use to access this sharedfolder
clsObj.DateAccessed() 'date of client access to shared folder
............
...........
..........
Very Urgent !!!!

Thanks.
Reply With Quote
  #2  
Old 06-30-2011, 10:00 AM
stokeentertainm's Avatar
stokeentertainm stokeentertainm is offline
Contributor
 
Join Date: Jan 2005
Location: Stoke-on-Trent, UK
Posts: 439
Default

Give an example of what you have so far and I will try and help.
Reply With Quote
  #3  
Old 07-01-2011, 01:36 AM
menglim menglim is offline
Newcomer
 
Join Date: Jun 2011
Posts: 3
Default

I found some code in VB6.
and I want to convert to VB.NET.
I want to have the structure above.

Thanks.

Code:
Private Const SESS_GUEST = &H1         'session logged on as a guest
Private Const SESS_NOENCRYPTION = &H2  'session not using encryption
Private Const NERR_SUCCESS As Long = 0&
Private Const MAX_PREFERRED_LENGTH As Long = -1
Private Const ERROR_MORE_DATA As Long = 234&
Private Const LB_SETTABSTOPS As Long = &H192

'for use on Win NT/2000 only
'Windows 95 / 98 is ignored in this case

Private Type SESSION_INFO_502
  sesi502_cname As Long
  sesi502_username As Long
  sesi502_num_open As Long
  sesi502_time As Long
  sesi502_idle_time As Long
  sesi502_user_flags As Long
  sesi502_cltype_name As Long
  sesi502_transport As Long
End Type
 
Private Type FILE_INFO_3
  fi3_id As Long
  fi3_permissions As Long
  fi3_num_locks As Long
  fi3_pathname As Long
  fi3_username As Long
End Type

Private Declare Function NetFileEnum Lib "netapi32" _
  (ByVal ServerName As Long, _
   ByVal basepath As Long, _
   ByVal UserName As Long, _
   ByVal level As Long, _
   bufptr As Long, _
   ByVal prefmaxlen As Long, _
   entriesread As Long, _
   totalentries As Long, _
   resume_handle As Long) As Long
   
Private Declare Function NetFileClose Lib "netapi32" _
    (ByVal ServerName As Long, ByVal FileID As Long) As Long


Private Declare Function NetSessionEnum Lib "netapi32" _
  (ByVal ServerName As Long, _
   ByVal UncClientName As Long, _
   ByVal UserName As Long, _
   ByVal level As Long, _
   bufptr As Long, _
   ByVal prefmaxlen As Long, _
   entriesread As Long, _
   totalentries As Long, _
   resume_handle As Long) As Long
   
Private Declare Function NetApiBufferFree Lib "netapi32" _
   (ByVal Buffer As Long) As Long
   
Private Declare Function SendMessage Lib "user32" _
   Alias "SendMessageA" _
  (ByVal hwnd As Long, _
   ByVal wMsg As Long, _
   ByVal wParam As Long, _
   lParam As Any) As Long
   
Private Declare Function NetSessionDel Lib "netapi32" _
    (ByRef ServerName As Byte, _
    ByRef UncClientName As Byte, _
    ByRef UserName As Byte) As Long
   

'Private Declare Function NetSessionEnum9x Lib "netapi32" _
'   Alias "NetSessionEnum" _
'  (ByVal pszServer As Long, _
'   ByVal level As Long, _
'   bufptr As Long, _
'cbBuffer As Long, _
'   entriesread As Long, _
'   totalentries As Long) As Long

'common routines
Private Declare Sub CopyMemory Lib "kernel32" _
   Alias "RtlMoveMemory" _
  (pTo As Any, uFrom As Any, _
   ByVal lSize As Long)
   
Private Declare Function lstrlenW Lib "kernel32" _
  (ByVal lpString As Long) As Long
  
  
Private FileIDArray() As Long


Public Sub DeleteOpenFile(lngSelectedList As Long)

Dim dwServer        As Long  'pointer to the server
Dim bServer         As String
Dim success         As Long

    If fncSystemTray.intMonitorSelf = 1 Then
        bServer = fncSystemTray.strOwnComputer
    Else
        bServer = fncSystemTray.strRemoteComputer
    End If
    
    dwServer = StrPtr(bServer)

    success = NetFileClose(dwServer, FileIDArray(lngSelectedList))


End Sub



'call when double item
Public Sub GetOpenFiles(Optional strUserName As String, Optional strFileSearch As String)
    Dim bServer         As String
    Dim bUserName       As String
    Dim dwServer        As Long  'pointer to the server
    Dim success         As Long
    Dim bufptr          As Long  'output
    Dim dwEntriesread   As Long  'out
    Dim dwTotalentries  As Long  'out
    Dim dwResumehandle  As Long  'out
    Dim nStructSize     As Long
    Dim dwUserName As Long
    Dim cnt             As Long
    Dim usrname         As String
    Dim fi3           As FILE_INFO_3
    Dim strFileName As String
    Dim strPermission As String
    Dim lngFileCount As Long
   .....................................
........................................
Reply With Quote
  #4  
Old 07-01-2011, 04:07 AM
stokeentertainm's Avatar
stokeentertainm stokeentertainm is offline
Contributor
 
Join Date: Jan 2005
Location: Stoke-on-Trent, UK
Posts: 439
Default

Okay, so what code have you actually written in .NET?
Reply With Quote
  #5  
Old 07-01-2011, 11:05 PM
menglim menglim is offline
Newcomer
 
Join Date: Jun 2011
Posts: 3
Default

I wanna make a class called clsFolderShared

and this class have properties and methods as I mentioned above.

Thanks for ur help.
Reply With Quote
  #6  
Old 07-02-2011, 06:07 AM
stokeentertainm's Avatar
stokeentertainm stokeentertainm is offline
Contributor
 
Join Date: Jan 2005
Location: Stoke-on-Trent, UK
Posts: 439
Default

No one is about to write code for you. Give us the code you have created for yourself so far and we may be able to help.
Reply With Quote
  #7  
Old 07-02-2011, 09:28 AM
AtmaWeapon's Avatar
AtmaWeaponShared Folder Monitor in VB.NET AtmaWeapon is offline
Fabulous Florist

Forum Leader
* Guru *
 
Join Date: Feb 2004
Location: Austin, TX
Posts: 9,500
Default

This is a pretty tall order; while stokeentertainm's expressing the general sentiment of the forums (we like people who can do some of the work themselves and respond faster when someone's halfway there) this is going to require some relatively advanced knowledge.

Are you familiar with P/Invoke? That's how VB .NET interacts with Windows API. You might want to check first if someone's already written this code. http://www.pinvoke.net is a good source, but usually doesn't have tutorials. You might also search for C# examples; search terms like "VB 2010 NetSessionEnum" or "C# NetSessionEnum" would sniff out any examples. Don't say, "I don't know C#"; it's *very* close to VB .NET and if you make even a halfhearted effort we'll be glad to help you figure out the tough parts.

So give the sites I linked and searches I mentioned a shot; ideally you'll find out someone else has written this. If not, take what you find, try to understand it, and we'll start working from there.

One note: in general, ignore sites that are about VB6. You have to have a good understanding of P/Invoke and .NET to understand how to use a VB6 example in VB .NET.
__________________
.NET Resources
My FAQ threads | Tutor's Corner | Code Library
I would bet money 2/3 of .NET questions are already answered in one of these three places.
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

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
Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET
 
Shared Folder Monitor in VB.NET
Shared Folder Monitor in VB.NET
 
-->