Access - Nombre del equipo

 
Vista:

Nombre del equipo

Publicado por ferran (66 intervenciones) el 04/10/2004 17:58:03
ES posible en código saber el nombre del equipo (ordenador) con el que se está trabajando??

Gracias.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Nombre del equipo

Publicado por Pancho (149 intervenciones) el 06/10/2004 16:11:21
Private Const MAX_COMPUTERNAME_LENGTH As Long = 31
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function ComputerName() As String
Dim dwLen As Long
Dim strString As String
'Create a buffer
'***************
dwLen = MAX_COMPUTERNAME_LENGTH + 1
strString = String(dwLen, "X")
'Get the computer name
'*********************
GetComputerName strString, dwLen
'get only the actual data
'************************
strString = Left(strString, dwLen)
'Show the computer name
ComputerName = strString
End Function
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Obtener nombre del usuario

Publicado por Pancho (149 intervenciones) el 06/10/2004 16:13:00
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Function UserName() As String
Dim strUsername As String
'Create a buffer
'***************
strUsername = String(255, Chr$(0))
'Get the username
'****************
GetUserName strUsername, 255
'Strip the rest of the buffer
'****************************
UserName = Left$(strUsername, InStr(strUsername, Chr$(0)) - 1)
End Function

Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar