home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 23 / IOPROG_23.ISO / COMMON / RTFAPI.ZIP / Esempi / Modulo1.bas < prev    next >
Encoding:
BASIC Source File  |  1998-04-25  |  2.0 KB  |  64 lines

  1. Attribute VB_Name = "Modulo1"
  2. '    Questo Φ un file dimostrativo sull'uso delle API in VB
  3. ' Φ stato creato per la rivista ioProgrammo della DiemmeEditori
  4. '    dal  Prof. Francesco Mannarino - Italy
  5. '                         il 25 Aprile 1998
  6. Option Explicit
  7.  
  8. Declare Function GetWindowsDirectory Lib _
  9. "kernel32" Alias "GetWindowsDirectoryA" _
  10. (ByVal lpBuffer As String, ByVal nSize As Long) _
  11. As Long
  12.  
  13.  
  14. Type SYSTEM_INFO
  15.   dwOemID As Long
  16.   dwPageSize As Long
  17.   lpMinimumApplicationAddress As Long
  18.   lpMaximumApplicationAddress As Long
  19.   dwActiveProcessorMask As Long
  20.   dwNumberOrfProcessors As Long
  21.   dwProcessorType As Long
  22.   dwAllocationGranularity As Long
  23.   dwReserved As Long
  24. End Type
  25.     
  26.     'costanti di GetSystemInfo()
  27.  Public Const PROCESSOR_INTEL_386 = 386
  28.  Public Const PROCESSOR_INTEL_486 = 486
  29.  Public Const PROCESSOR_INTEL_PENTIUM = 586
  30.  Public Const PROCESSOR_MIPS_R4000 = 4000
  31.  Public Const PROCESSOR_ALPHA_21064 = 21064
  32.  
  33. Public MioSysInfo As SYSTEM_INFO
  34.  
  35. Declare Sub GetSystemInfo Lib "kernel32" (lpSystemInfo As SYSTEM_INFO)
  36.    
  37.    ' Funzione  API GetVolumeInformation
  38. Declare Function GetVolumeInformation Lib _
  39.    "kernel32" Alias "GetVolumeInformationA" _
  40.    (ByVal lpRootPathName As String, _
  41.    ByVal lpVolumeNameBuffer As String, _
  42.    ByVal nVolumeNameSize As Long, _
  43.    lpVolumeSerialNumber As Long, _
  44.    lpMaximumComponentLength As Long, _
  45.    lpFileSystemFlags As Long, _
  46.    ByVal lpFileSystemNameBuffer As String, _
  47.    ByVal nFileSystemNameSize As Long) _
  48.    As Long
  49.  
  50.  
  51.  ' funzione che trasforma un stringa terminante con zero
  52.  ' in una senza
  53. Public Function StrNulToStr(ByVal Str_Nul$, ByVal Size As Long) As String
  54.   Dim k, SizeKont As Long
  55.     SizeKont = Size
  56.    If Size = 0 Then SizeKont = 256 ' valore di default se non si passa
  57.                                    ' alcun argomento per la lunghezza
  58.    For k = 1 To SizeKont
  59.      If Asc(Mid(Str_Nul$, k, 1)) = 0 Then Exit For ' per sicurezza Φ meglio cos∞
  60.      StrNulToStr = StrNulToStr + Mid(Str_Nul$, k, 1)
  61.    Next
  62. End Function
  63.  
  64.