Private Declare Function SetComputerName Lib "kernel32" Alias "SetComputerNameA" (ByVal lpComputerName As String) As Long
Public Function SetCName(CName) As Boolean
Dim lResult As Long
Dim RV As Boolean
lResult = SetComputerName(CName)
If lResult <> 0 Then
RV = True '修改成功
Else
RV = False
End If
SetCName = RV
End Function
Private Sub Command1_Click()
If SetCName("hxfly") = True Then
MsgBox ("修改成功")
End If
End Sub