Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Who Has File Open?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Who Has File Open?
Divers
Thread ID:
00654166
Message ID:
00654166
Vues:
47
This will tell you what remote users have a file open over an SMB share. Just thought it might be helpful. Doesn't use the API directly, this is with WSH.
	*	Determine who has a file open - VFP7/SP1 , WSH5.6
	*	Use to protect or take action for a table that someone might have open over the network
		Clear
		Local iRow as Integer
		Local cConnstring as Character
		Local oThing as Object	
		oNet = CreateObject("Wscript.Network")
		cConnString = "WinNT://" + oNet.ComputerName + "/LanmanServer"
		oFSO = GetObject( cConnString )
		iRow = 1
		Dimension arResources[iRow,2]
		For Each oThing in oFSO.Resources
			If Vartype(oThing.User) = "C"
				arResources[iRow,1] = oThing.User
			EndIf
			If Vartype(oThing.Path) = "C"
				arResources[iRow,2] = oThing.Path
			EndIf			
			iRow = iRow + 1
			Dimension arResources[iRow,2]
		Next		
		Display Memory like arResources
Any comments on how to tweak this are appreciated.
Répondre
Fil
Voir

Click here to load this message in the networking platform