📄 设置计算机名.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BackColor = &H80000004&
Caption = "Form1"
ClientHeight = 1905
ClientLeft = 60
ClientTop = 345
ClientWidth = 4170
LinkTopic = "Form1"
ScaleHeight = 1905
ScaleWidth = 4170
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "确 认"
Height = 315
Left = 2130
TabIndex = 5
Top = 1440
Width = 1365
End
Begin VB.CommandButton Command1
Caption = "重 置"
Height = 315
Left = 630
TabIndex = 4
Top = 1440
Width = 1365
End
Begin VB.TextBox Text2
Alignment = 1 'Right Justify
Height = 345
Left = 1770
TabIndex = 0
Top = 780
Width = 1755
End
Begin VB.TextBox Text1
Alignment = 1 'Right Justify
Height = 345
Left = 1770
TabIndex = 1
Text = "Text1"
Top = 240
Width = 1755
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "新计算机名:"
Height = 180
Left = 600
TabIndex = 3
Top = 870
Width = 1080
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "原计算机名:"
Height = 180
Left = 570
TabIndex = 2
Top = 330
Width = 1080
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function GetComputerName& Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long)
Private Declare Function SetComputerName Lib "kernel32" Alias "SetComputerNameA" (ByVal lpComputerName As String) As Long
Private Sub Form_Load()
Dim strRetu As String * 256
GetComputerName strRetu, 255
Text1 = Left(strRetu, InStr(strRetu, Chr(0)) - 1)
End Sub
Private Sub Command1_Click()
Text2 = ""
Text2.SetFocus
End Sub
Private Sub Command2_Click()
SetComputerName Text2
Unload Me
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -