'Inserire la seguente dichiarazione in un modulo Bas
Public Declare Function GetComputerName Lib "Kernel32" _ Alias "GetComputerNameA" (ByVal lpBuffer as String, nSize as Long) as Long 'Creare una funzione pubblica da richiamare cosi: MiaStringa = NomeComputer Public Function NomeComputer() as String Dim sBuffer as String * 255 If GetComputerName(sBuffer, 255& ) <> 0 Then NomeComputer = Left$(sBuffer, InStr( sBuffer , vbNullChar ) - 1) Else NomeComputer = "Sconosciuto" End If End Function |