preso da www.allapi.net (mitico sito!!)
io ora mi chiedo un cosa.. se il parametro lpBuffer è passato ByVal, come può la funzione metterci il nome del Computer??codice:'example by Donavon Kuhn (Donavon.Kuhn@Nextel.com) 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 Private Sub Form_Load() 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 MsgBox strString End Sub
nel senso: se il passaggio è ByVal-->per copia come può la funzione scriverci dentro?? non dovrebbe essere passata ByRef??
Siccome il codice funziona, in quello che dico c'è "something wrong"..
forse non ho capito bene qlcosina.. potreste svelarmi l'arcano?
Ciao!!