home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / SplitMaste214136202001.psc / modAPI.bas < prev    next >
Encoding:
BASIC Source File  |  2001-06-18  |  2.9 KB  |  68 lines

  1. Attribute VB_Name = "modAPI"
  2. Public Type MEMORYSTATUS
  3.         dwLength As Long
  4.         dwMemoryLoad As Long
  5.         dwTotalPhys As Long
  6.         dwAvailPhys As Long
  7.         dwTotalPageFile As Long
  8.         dwAvailPageFile As Long
  9.         dwTotalVirtual As Long
  10.         dwAvailVirtual As Long
  11. End Type
  12.  
  13. Public Declare Sub GlobalMemoryStatus Lib "KERNEL32" (lpBuffer As MEMORYSTATUS)
  14. Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
  15.  
  16. Public Const GENERIC_WRITE = &H40000000
  17. Public Const GENERIC_READ = &H80000000
  18. Public Const FILE_ATTRIBUTE_NORMAL = &H80
  19. Public Const CREATE_ALWAYS = 2
  20. Public Const OPEN_ALWAYS = 4
  21. Public Const INVALID_HANDLE_VALUE = -1
  22.  
  23. Public Declare Function ReadFile Lib "KERNEL32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToRead As Long, lpNumberOfBytesRead As Long, ByVal lpOverlapped As Long) As Long
  24. Public Declare Function CloseHandle Lib "KERNEL32" (ByVal hObject As Long) As Long
  25. Public Declare Function WriteFile Lib "KERNEL32" (ByVal hFile As Long, lpBuffer As Any, ByVal nNumberOfBytesToWrite As Long, lpNumberOfBytesWritten As Long, ByVal lpOverlapped As Long) As Long
  26. Public Declare Function CreateFile Lib "KERNEL32" Alias "CreateFileA" (ByVal lpFileName As String, ByVal dwDesiredAccess As Long, ByVal dwShareMode As Long, ByVal lpSecurityAttributes As Long, ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAttributes As Long, ByVal hTemplateFile As Long) As Long
  27. Public Declare Function FlushFileBuffers Lib "KERNEL32" (ByVal hFile As Long) As Long
  28.  
  29. Private Declare Sub GetLocalTime Lib "KERNEL32" (lpSystemTime As SystemTime)
  30.  
  31. Type SystemTime
  32.         wYear As Integer
  33.         wMonth As Integer
  34.         wDayOfWeek As Integer
  35.         wDay As Integer
  36.         wHour As Integer
  37.         wMinute As Integer
  38.         wSecond As Integer
  39.         wMilliseconds As Integer
  40. End Type
  41.  
  42. Public Property Get getTime() As Double
  43. Dim currentTime As SystemTime
  44.     Call GetLocalTime(currentTime)
  45.     getTime = (currentTime.wHour * CLng(3600000) + currentTime.wMinute * CLng(60000) + currentTime.wSecond * CLng(1000) + currentTime.wMilliseconds) / CLng(1000)
  46.     Exit Property
  47. End Property
  48.  
  49. Public Function DetermineDirectory(inputString As String) As String
  50. Dim pos As Integer
  51.     pos = InStrRev(inputString, "\", , vbTextCompare)
  52.     DetermineDirectory = Mid(inputString, 1, pos)
  53. End Function
  54.  
  55. Public Function DetermineFilename(inputString As String) As String
  56. Dim pos As Integer
  57.     pos = InStrRev(inputString, "\", , vbTextCompare)
  58.     DetermineFilename = Mid(inputString, pos + 1, Len(inputString) - pos)
  59. End Function
  60.  
  61. Public Function DetermineDrive(inputString As String) As String
  62. Dim pos As Integer
  63.     If inputString = "" Then Exit Function
  64.     pos = InStr(1, inputString, ":\", vbTextCompare)
  65.     DetermineDrive = Mid(inputString, 1, pos - 1)
  66. End Function
  67.  
  68.