Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get list of open files
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01297544
Message ID:
01297552
Views:
36
>Hi there
>am just wondering how to get list of all open files by a applications. I know how to get list of processes using WMI script but have not found any method to see files opened by that process.
>
>any ideas much appreciated.

I guess you are looking for network files opened, I wrote this small program but never finished for I got sidetracked by other more important issues <g> You can see it is very easy, the core is of all but 4 lines of code, all the rest is just code to create cursors and put the info into it
local loConnection, loResources, loResource, llValid

loConnection			= GetObject("WinNT://SKYAPPS/LanmanServer") && SKYAPPS is our server, you should change this to yours
loResources			= loConnection.Resources()

create cursor C_Resources ;
	( ;
		PK		I Autoinc		, ;
		Name	C(240)			, ;
		User	C(64)			, ;
		Path	C(240)			, ;
		ADsPath	C(240)			, ;
		GUID	C(64)			, ;
		Schema	C(240)			, ;
		Locks	I				  ;
	)
		
For Each loResource in loResources
	with loResource
		try
			lcPath					= .Path
			llValid					= .t.
		catch
			llValid					= .f.
		endtry
		if llValid
			wait window 'Adding resource: ' + .Path nowait
			insert into C_Resources ;
					( ;
						User				, ;
						Name				, ;
						Path				, ;
						ADsPath				, ;
						GUID				, ;
						Schema				, ;
						Locks				  ;
					) ;
				values ;
					( ;
						.User				, ;
						.Name				, ;
						.Path				, ;
						.ADsPath			, ;
						.GUID				, ;
						.Schema				, ;
						.LockCount			  ;
					)
		endif
	endwith
endfor

wait window 'Creating indexes...' nowait

index on	PK		tag PK
index on	Path		tag Path
index on	User		tag User

wait clear
"The five senses obstruct or deform the apprehension of reality."
Jorge L. Borges?

"Premature optimization is the root of all evil in programming."
Donald Knuth, repeating C. A. R. Hoare

"To die for a religion is easier than to live it absolutely"
Jorge L. Borges
Previous
Reply
Map
View

Click here to load this message in the networking platform