home *** CD-ROM | disk | FTP | other *** search
/ Programming Tool Box / SIMS_2.iso / vb_code1 / dat_time / datetime.bas next >
BASIC Source File  |  1991-10-07  |  1KB  |  31 lines

  1. DefInt A-Z
  2. '==========================================================================
  3. '  This VB program demonstrates how to get a files date/time stamp and file
  4. '  size directly from within Visual Basic and not resorting to a shell to
  5. '  the DOS "DIR" command.
  6. '==========================================================================
  7.  
  8. '=== Structure used to save returned values from OpenFile
  9. '=== NOTE: note the normal 4 byte "reserved" field in the OFSTRUCT
  10. '=== needs to be changed to two byte fields r1 and r2.
  11.     
  12. Type OFSTRUCT                    '************************************
  13.     cBytes As String * 1         '* NOTE: This type definition       *
  14.     fFixedDisk As String * 1     '* must appear before the API       *
  15.     nErrCode As Integer          '* declaration because lpReOpenBuff *
  16.     r1 As Integer                '* is defined "As OFSTRUCT" in the  *
  17.     r2 As Integer                '* OpenFile API function declaration*
  18.     szPathName As String * 128   '************************************
  19. End Type
  20.  
  21. '=== API function to open files
  22.     
  23. Declare Function OpenFile Lib "Kernel" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Integer) As Integer
  24.  
  25. '=== OF_EXIST paramter simply causes a test for a files existence.
  26. '=== OpenFile will return the file handle if it exists
  27. '=== or OpenFile returns -1 if the file does not exist.
  28.     
  29. Global Const OF_EXIST = &H4000
  30.  
  31.