新建From1(窗体),新建Command1(按钮CommandButton),代码:
Declare Function SetComputerName Lib "kernel32" Alias "SetComputerNameA" (ByVal lpComputerName As String) As Long Private Sub Command1_Click() NewName = "Hello World" SetComputerName NewName End Sub