>Hi All,
>
>Does anyone know of a way to find out whether a certain Datasession number is currently in use? The function AUSED( laUsed, 10 ) will generate an error if that number (10) is still not in use.
Peter,
VFP7 and later has asessions() to get available sessions.
Prior to VFP7 only VFP6 has session object (if I remember right), others could only have private sessions through forms. You could access and loop session and form objects with _vfp.objects and get datasessionIDs into an array. ie:
local array laSessions[1], laUsed[1]
local ix
laSessions=1
for ix=1 to GetSessions(@laSessions)
? aused(laUsed,laSessions[ix])
endfor
function GetSessions
lparameters taSessions
local ix
for ix=1 to _vfp.objects.count
with _vfp.objects(ix)
if type('.Datasession') = 'N' and .Datasession = 2
dimension taSessions[alen(taSessions)+1]
taSessions[alen(taSessions)] = .DataSessionID
endif
endwith
endfor
return alen(taSessions)
Cetin