home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 32 / IOPROG_32.ISO / COMMON / RTFAPI.ZIP / Esempi / Form1.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-04-25  |  4.2 KB  |  126 lines

  1. VERSION 5.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "Esempi di implentazione routine API"
  4.    ClientHeight    =   2820
  5.    ClientLeft      =   1815
  6.    ClientTop       =   1830
  7.    ClientWidth     =   5760
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   2820
  10.    ScaleWidth      =   5760
  11.    Begin VB.Menu mnu_esempi 
  12.       Caption         =   "&Esempi"
  13.       Index           =   10
  14.       Begin VB.Menu mnu 
  15.          Caption         =   "&1. esempio"
  16.          Index           =   10
  17.       End
  18.       Begin VB.Menu mnu 
  19.          Caption         =   "&2. esempio"
  20.          Index           =   20
  21.       End
  22.       Begin VB.Menu mnu 
  23.          Caption         =   "&3. esempio"
  24.          Index           =   30
  25.       End
  26.       Begin VB.Menu mnu 
  27.          Caption         =   "&4. esempio"
  28.          Index           =   40
  29.       End
  30.    End
  31.    Begin VB.Menu mnu_esci 
  32.       Caption         =   "E&sci"
  33.    End
  34. Attribute VB_Name = "Form1"
  35. Attribute VB_GlobalNameSpace = False
  36. Attribute VB_Creatable = False
  37. Attribute VB_PredeclaredId = True
  38. Attribute VB_Exposed = False
  39. '    Questo 
  40.  un file dimostrativo sull'uso delle API in VB
  41.  stato creato per la rivista ioProgrammo della DiemmeEditori
  42. '    dal  Prof. Francesco Mannarino - Italy
  43. '                         il 25 Aprile 1998
  44. Option Explicit
  45. Private Sub mnu_esci_Click()
  46.    Unload Me
  47. End Sub
  48. Private Sub mnu_Click(Index As Integer)
  49.   Form1.Cls
  50.   Select Case Index
  51.      Case Is = 10
  52.         PrimoEsempio
  53.      Case Is = 20
  54.         SecondoEsempio
  55.      Case Is = 30
  56.         TerzoEsempio
  57.      Case Is = 40
  58.         QuartoEsempio
  59.   End Select
  60. End Sub
  61. Private Sub PrimoEsempio()
  62.   Dim Risult&
  63.   Dim WinDir As String * 145
  64.   WinDir = String(256, 0)
  65.   Risult& = GetWindowsDirectory(WinDir, 145)
  66.   Print "valore di ritorno = " & Risult&
  67.   Print "Directory Windows = " & StrNulToStr(WinDir, Risult&)
  68. End Sub
  69. Private Sub SecondoEsempio()
  70.   Dim WinDir As String * 145
  71.   WinDir = String(256, 0)
  72.   Call GetWindowsDirectory(WinDir, 145)
  73.   Print "Directory Windows = " & StrNulToStr(WinDir, 0)
  74. End Sub
  75. Private Sub TerzoEsempio()
  76.        ' chiamata a GetSystemInfo(...)
  77.        Const TpPrc = "Tipo Processore"
  78.        GetSystemInfo MioSysInfo
  79.      Print "Tipo  processore usato"; Tab(50); MioSysInfo.dwOemID
  80.      Print "Grandezza pagina usata"; Tab(50); MioSysInfo.dwPageSize
  81.      Print "Indirizzo pi
  82.  basso per un'applicazione"; Tab(50); _
  83.         MioSysInfo.lpMinimumApplicationAddress
  84.      Print "Indirizzo pi
  85.  alto per un'applicazione"; Tab(50); _
  86.         MioSysInfo.lpMaximumApplicationAddress
  87.      Print "numero di processori configurati nel sistema "; Tab(50); _
  88.         MioSysInfo.dwActiveProcessorMask
  89.      Print "numero di processori nel sistema "; Tab(50); _
  90.         MioSysInfo.dwNumberOrfProcessors
  91.         Select Case MioSysInfo.dwProcessorType
  92.             Case PROCESSOR_INTEL_386
  93.               Print TpPrc; Tab(50); "Intel 386"
  94.             Case PROCESSOR_INTEL_486
  95.               Print TpPrc; Tab(50); "Intel 486"
  96.             Case PROCESSOR_INTEL_PENTIUM
  97.               Print TpPrc; Tab(50); "Intel Pentium"
  98.             Case PROCESSOR_MIPS_R4000
  99.               Print TpPrc; Tab(50); "MIPS R4000"
  100.             Case PROCESSOR_ALPHA_21064
  101.               Print TpPrc; Tab(50); "Alpha 21064"
  102.         End Select
  103.       Print "granularit
  104.  "; Tab(50); _
  105.          MioSysInfo.dwAllocationGranularity
  106. End Sub
  107. Private Sub QuartoEsempio()
  108.   Dim Risult&, NrSeriale&
  109.   Dim GrandMaxFileName&, TipoFlSys&
  110.   Dim StrNulNomeVol$, StrNulFlSys$
  111.   StrNulNomeVol$ = String$(256, 0)
  112.   StrNulFlSys$ = String$(256, 0)
  113.   Risult& = GetVolumeInformation("c:\", _
  114.    StrNulNomeVol$, 255, NrSeriale&, _
  115.    GrandMaxFileName&, TipoFlSys&, StrNulFlSys$, 255)
  116.      Print "nome Drive"; Tab(50); "c:\"
  117.      Print "nome Volume"; Tab(50); StrNulToStr(StrNulNomeVol$, 0)
  118.      Print "Nr Seriale"; Tab(50); NrSeriale&
  119.      Print "Max grand di un file"; Tab(50); GrandMaxFileName&
  120.      Print "Tipo File System"; Tab(50); TipoFlSys&
  121.      Print "    qui sopra 
  122.  stato omesso l'uso delle costanti"
  123.      Print "Nome File System"; Tab(50); StrNulToStr(StrNulFlSys$, 0)
  124.      Print "Risultato (1=OK / 0=fail)"; Tab(50); Risult&
  125. End Sub
  126.