Hi All:
Last night I was reading the Jan 97 FoxTalk and came across Doug Hennig's
article, "Working with Arrays." In it he includes his code for
CloseOpenedTables, which he could pull from an array generated by VFP's
AUSED() function. I've used AUSED() and have come to appreciate its value.
(Remember when YOU discovered ADIR() in FP 2.x?) Well, I thought we needed
an AUSER() in FP 2.x, too. Here it is.
*!*******************************************************************
*! Function..........: AUsed()
*! Author............: David Lee Powell
*! Project...........: Visual FoxPro Functions for FoxPro 2.x
*! Created...........: 09-Feb-97
*! Copyright.........: (c) 1997, Data-Train MicroComputing
*! : I grant usage to anyone interested, however,
*! : in hopes that increased functionality for our
*! : earlier FoxPro versions will result.
*) Description.......: Emulates the AUSED() function of VFP
*! Syntax/Usage......: DIME laUsed[ 1, 2 ]
*! : jnOpen = AUsed( @laUsed )
*! Note..............: The array variable is passed by reference,
*! : unlike that of VFP. The first column of the
*! : array is filled with the ALIAS() and the second
*! : column is filled with the SELECT() value.
*! Parameter list....: laUsed - array variable to be filled with
*! : the aliases currently open
*! Platform..........: DOS/WIN
*! Major change list.: None
*! Called by.........: Any
*! Calls.............: None
*!*******************************************************************
FUNC AUsed
PARA laUsed
jnArrows = 0 && "Array row" count :^)
FOR jj = 1 TO 225 && Loop through the work areas
IF ! EMPT( ALIA( jj ) ) && If an ALIAS occurs here
jnArrows = jnArrows + 1 && Increase the row count
DIME laUsed[ jnArrows, 2 ] && Re-dimension array by 1 row
laUsed[ jk, 1 ] = ALIA( jj ) && First column: ALIAS
laUsed[ jk, 2 ] = jj && Second column: SELECT area
ENDI
NEXT (jj)
RELE jj && Clean up memvar space a little
RETU jk
----------------------------------------------------------------------
Admittedly, there is more documentation than code, but so what? Can you
use this? I hope so.
David in Dallas.
--- Maximus/2 3.01
---------------
* Origin: * MacSavvy OS/2 BBS * Dallas, Texas * 972-250-4479 * (1:124/1208)
|