Sandro Bizioli


Chi sogna di giorno conosce molte cose che sfuggono a chi sogna soltanto di notte. (E.A.Poe)
Mappa

Recuperare il nome del pc attualmente in uso.

Altro semplice esempio questa volta per recuperare il nome del computer in uso.
Il sorgente è compatibile con Visual Basic 5 e Visual Basic 6

Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, ByRef nSize As Long) As Long

Public Function GetPCName() As String
'**************************************************************************
'Func.: GetPCName (Creazione SB-29/03/2000; Mod.: )
'Desc.: Restituisce il nome del PC in uso
'Par. :
'Ret. : Il nome del PC
'**************************************************************************
Dim cBuf As String
Dim nSize As Long
Dim Vax As Long
cBuf = String$(255, 0)
nSize = Len(cBuf)
Vax = GetComputerName(cBuf, nSize)
cBuf = Left$(cBuf, nSize)
GetPCName = IIf(Right$(cBuf, 1) = Chr$(0), Left$(cBuf, Len(cBuf) - 1), cBuf)

End Function

Categoria: VB6
martedì, 27 feb 2007 Ore. 15.06
Statistiche
  • Views Home Page: 109.884
  • Views Posts: 560.140
  • Views Gallerie: 108.934
  • n° Posts: 227
  • n° Commenti: 222
Copyright © 2002-2007 - Blogs 2.0
dotNetHell.it | Home Page Blogs
ASP.NET 2.0 Windows 2003