Visual Basic Core Snippet Routines
IsFolderShared
          
                 
   Pass a folder, returns True if the folder is currently shared, False if not.           
           Updated:   Monday December 26, 2011   
click to copy code:  



   Applies to:   VB4-32, VB5, VB6   
OS restrictions:   None  
 Code Snippet
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce 
'               or publish this code on any web site,
'               online service, or distribute as source 
'               on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Private Const SHGFI_ATTRIBUTES As Long = &H800
Private Const SFGAO_SHARE As Long = &H20000
Private Const MAX_PATH As Long = 260

Private Type SHFILEINFO
   hIcon As Long
   iIcon As Long
   dwAttributes As Long
   szDisplayName As String * MAX_PATH
   szTypeName As String * 80
End Type

Private Declare Function SHGetFileInfo Lib "shell32.dll" _
   Alias "SHGetFileInfoA" _
  (ByVal pszPath As String, _
   ByVal dwFileAttributes As Long, _
   psfi As SHFILEINFO, _
   ByVal cbFileInfo As Long, _
   ByVal uFlags As Long) As Long
         

Private Function IsFolderShared(ByVal sFolderName As String) As Boolean

   Dim sfi As SHFILEINFO
   SHGetFileInfo sFolderName, 0&, sfi, Len(sfi), SHGFI_ATTRIBUTES
   IsFolderShared = (sfi.dwAttributes And SFGAO_SHARE)
   
End Function

 Calling Syntax
  bIsShared = IsFolderShared("d:\somefolder")

 Comments / Related
demo in use:       
Related:       

 
 

PayPal Link
Make payments with PayPal - it's fast, free and secure!

 
 
 
 

Copyright ©1996-2011 VBnet and Randy Birch. All Rights Reserved.
Terms of Use  |  Your Privacy

 

Hit Counter