En un modulo tengo las declaraciones de la API
Public Declare Function gethostname Lib _
"WSOCK32.DLL" (ByVal hostname$, HostLen&) As Long
Por ejemplo, en el Form_Load() tengo esto:
Dim hostname As String * 256
If gethostname(hostname, 256) = SOCKET_ERROR Then
MsgBox "Windows Sockets error " & Str(WSAGetLastError())
Exit Sub
Else
hostname = Trim$(hostname)
End If ,
Y me tira el Mensaje de Error, sin asignarle nada a la variable cadena hostname.
