home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form Form1
- Caption = "Esempi di implentazione routine API"
- ClientHeight = 2820
- ClientLeft = 1815
- ClientTop = 1830
- ClientWidth = 5760
- LinkTopic = "Form1"
- ScaleHeight = 2820
- ScaleWidth = 5760
- Begin VB.Menu mnu_esempi
- Caption = "&Esempi"
- Index = 10
- Begin VB.Menu mnu
- Caption = "&1. esempio"
- Index = 10
- End
- Begin VB.Menu mnu
- Caption = "&2. esempio"
- Index = 20
- End
- Begin VB.Menu mnu
- Caption = "&3. esempio"
- Index = 30
- End
- Begin VB.Menu mnu
- Caption = "&4. esempio"
- Index = 40
- End
- End
- Begin VB.Menu mnu_esci
- Caption = "E&sci"
- End
- Attribute VB_Name = "Form1"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' Questo
- un file dimostrativo sull'uso delle API in VB
- stato creato per la rivista ioProgrammo della DiemmeEditori
- ' dal Prof. Francesco Mannarino - Italy
- ' il 25 Aprile 1998
- Option Explicit
- Private Sub mnu_esci_Click()
- Unload Me
- End Sub
- Private Sub mnu_Click(Index As Integer)
- Form1.Cls
- Select Case Index
- Case Is = 10
- PrimoEsempio
- Case Is = 20
- SecondoEsempio
- Case Is = 30
- TerzoEsempio
- Case Is = 40
- QuartoEsempio
- End Select
- End Sub
- Private Sub PrimoEsempio()
- Dim Risult&
- Dim WinDir As String * 145
- WinDir = String(256, 0)
- Risult& = GetWindowsDirectory(WinDir, 145)
- Print "valore di ritorno = " & Risult&
- Print "Directory Windows = " & StrNulToStr(WinDir, Risult&)
- End Sub
- Private Sub SecondoEsempio()
- Dim WinDir As String * 145
- WinDir = String(256, 0)
- Call GetWindowsDirectory(WinDir, 145)
- Print "Directory Windows = " & StrNulToStr(WinDir, 0)
- End Sub
- Private Sub TerzoEsempio()
- ' chiamata a GetSystemInfo(...)
- Const TpPrc = "Tipo Processore"
- GetSystemInfo MioSysInfo
- Print "Tipo processore usato"; Tab(50); MioSysInfo.dwOemID
- Print "Grandezza pagina usata"; Tab(50); MioSysInfo.dwPageSize
- Print "Indirizzo pi
- basso per un'applicazione"; Tab(50); _
- MioSysInfo.lpMinimumApplicationAddress
- Print "Indirizzo pi
- alto per un'applicazione"; Tab(50); _
- MioSysInfo.lpMaximumApplicationAddress
- Print "numero di processori configurati nel sistema "; Tab(50); _
- MioSysInfo.dwActiveProcessorMask
- Print "numero di processori nel sistema "; Tab(50); _
- MioSysInfo.dwNumberOrfProcessors
- Select Case MioSysInfo.dwProcessorType
- Case PROCESSOR_INTEL_386
- Print TpPrc; Tab(50); "Intel 386"
- Case PROCESSOR_INTEL_486
- Print TpPrc; Tab(50); "Intel 486"
- Case PROCESSOR_INTEL_PENTIUM
- Print TpPrc; Tab(50); "Intel Pentium"
- Case PROCESSOR_MIPS_R4000
- Print TpPrc; Tab(50); "MIPS R4000"
- Case PROCESSOR_ALPHA_21064
- Print TpPrc; Tab(50); "Alpha 21064"
- End Select
- Print "granularit
- "; Tab(50); _
- MioSysInfo.dwAllocationGranularity
- End Sub
- Private Sub QuartoEsempio()
- Dim Risult&, NrSeriale&
- Dim GrandMaxFileName&, TipoFlSys&
- Dim StrNulNomeVol$, StrNulFlSys$
- StrNulNomeVol$ = String$(256, 0)
- StrNulFlSys$ = String$(256, 0)
- Risult& = GetVolumeInformation("c:\", _
- StrNulNomeVol$, 255, NrSeriale&, _
- GrandMaxFileName&, TipoFlSys&, StrNulFlSys$, 255)
- Print "nome Drive"; Tab(50); "c:\"
- Print "nome Volume"; Tab(50); StrNulToStr(StrNulNomeVol$, 0)
- Print "Nr Seriale"; Tab(50); NrSeriale&
- Print "Max grand di un file"; Tab(50); GrandMaxFileName&
- Print "Tipo File System"; Tab(50); TipoFlSys&
- Print " qui sopra
- stato omesso l'uso delle costanti"
- Print "Nome File System"; Tab(50); StrNulToStr(StrNulFlSys$, 0)
- Print "Risultato (1=OK / 0=fail)"; Tab(50); Risult&
- End Sub
-