home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / xbase / library / dbase / udfs / udf4.prg < prev    next >
Text File  |  1992-05-06  |  1KB  |  45 lines

  1. /*
  2.  
  3. Author:           DAVID -(FLASH)- GORDON     CompuServ ID - 75130,3664
  4.  
  5. Originally:       Program COPYRIGHT 1991, FlashPoint
  6.  
  7. Now and Forever:  Released into the Public Domain
  8.  
  9. Note:             FlashPoint is a Registered Trademark
  10.  
  11. Purpose:          IsOpen() was designed to ensure a database would not be 
  12.                   unintentionally opened a second time on a network by the
  13.                   same user.  This version is limited to the user having a
  14.                   maximum of 20 databases opened at one time.  It will select
  15.                   the database so you can go on with whatever you were doing.
  16. */
  17.  
  18. * Usage In Your Application
  19. ******************************************************************************
  20.  
  21. IF ! IsOpen("cFile")
  22.     IF ! NetUse(cFile, "cFile", .f., "Attempt To Open File", 1)
  23.         QUIT
  24.     ENDIF
  25. ENDIF    
  26.  
  27. IF IsOpen("cFile")
  28.     DBCLOSEAREA()
  29. ENDIF
  30.  
  31. ******************************************************************************
  32.  
  33. FUNCTION IsOpen(cPassAlias)
  34.     LOCAL nI := 1, cAlias := "", nArea := 0
  35.     FOR nI := 1 to 20
  36.         cAlias := alias(nI)
  37.         IF UPPER(ALLTRIM(cAlias)) == UPPER(ALLTRIM(cPassAlias))
  38.             nArea := DBSELECTAREA(cAlias)
  39.             DBSELECTAREA(nArea)
  40.             RETU .T.
  41.         ENDIF
  42.     NEXT
  43. RETURN .F.
  44.  
  45.