Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
2000 Server Services File
Message
De
04/11/2002 03:05:50
 
 
À
01/11/2002 14:04:46
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00717955
Message ID:
00718385
Vues:
16
You can set reference (Project|References...) to "Microsoft Scripting Runtime" and use code like this:
Dim FSO As Scripting.FileSystemObject
Dim FileStream As Scripting.TextStream
Dim FileContent As String
Dim StartPosition As Long
Dim EndPosition As Long
Dim LineContents As String

  Set FSO = New Scripting.FileSystemObject
  Set FileStream = FSO.OpenTextFile("C:\WINNT\SYSTEM32\DRIVERS\etc\Services")
  FileContent = FileStream.ReadAll
  StartPosition = InStr(1, FileContent, "van52", vbBinaryCompare)
  If StartPosition > 0 Then  'Line is founded
    EndPosition = InStr(StartPosition, FileContent, vbCr, vbBinaryCompare)
    LineContents = Mid(FileContent, StartPosition, EndPosition - StartPosition)
  End If
  FileStream.Close
  Set FileStream = Nothing
  Set FSO = Nothing
After this, extract number from founded line.

Plamen Ivanov
MCSD .NET Early Achiever and MCAD .NET Charter Member (VB .NET/SQL Server 2000)
MCSD (VB 6.0/SQL Server 2000)

VB (.NET) - what other language do you need in the whole Universe?...

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform