home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / is_file / isfile.bas next >
BASIC Source File  |  1993-08-14  |  728b  |  24 lines

  1. Option Explicit
  2.  
  3. Type OFSTRUCT '136 bytes --- Data Structure for OpenFile call
  4.  cBytes As String * 1
  5.  fFixedDisk As String * 1
  6.  nErrCode As Integer
  7.  reserved As String * 4
  8.  szPathName As String * 128
  9. End Type
  10. Global Const OF_EXIST = &H4000
  11. Declare Function OpenFile% Lib "KERNEL" (ByVal lpFileName$, lpReOpenBuff As OFSTRUCT, ByVal wStyle%)
  12.  
  13.  
  14.  
  15. Function IsFile% (NameOfFile As String)
  16. 'True  = File Exists
  17. 'False = File does not exist
  18.  Dim Result As Integer, Response As OFSTRUCT, OF_EXIST As Integer
  19.  Result = OpenFile(NameOfFile, Response, OF_EXIST)
  20.  'Response.nErrCode can be used to determine the exact error if needed if the future.
  21.  If Result < 0 Then IsFile = False Else IsFile = True
  22. End Function
  23.  
  24.