1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| Declare Function SetComputerName Lib "kernel32" Alias "SetComputerNameA" (ByVal lpComputerName As String) As Long
Public Function ChangerNomOrdi(NouveauNomOrdi As String) As Boolean
On Error Resume Next
Dim Changer As Long
Changer = SetComputerName(NouveauNomOrdi)
If Err.Number = 0 Then
ChangerNomOrdi = True
Else
ChangerNomOrdi = False
End If
End Function
'Pour Changer le nom de votre ordinateur :
Dim Retour As Boolean
Retour = ChangerNomOrdi("MonOrdi")
If Retour = True Then
MsgBox("Le nom de votre ordinateur a été changé")
Else
MsgBox("Le nom de votre ordinateur n'a pas été changé")
End If |