📄 form1.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 1680
ClientLeft = 60
ClientTop = 345
ClientWidth = 4875
LinkTopic = "Form1"
ScaleHeight = 1680
ScaleWidth = 4875
StartUpPosition = 3 'Windows Default
Begin MSComDlg.CommonDialog CDialog2
Left = 4320
Top = 1200
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin MSComDlg.CommonDialog CDialog1
Left = 4320
Top = 480
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton cmdRestore
Caption = "导入"
Height = 375
Left = 3480
TabIndex = 8
Top = 1200
Width = 615
End
Begin VB.CommandButton cmdSave
Caption = "导出"
Height = 375
Left = 2640
TabIndex = 7
Top = 1200
Width = 615
End
Begin VB.CommandButton txtDelete
Caption = "删除"
Height = 375
Left = 1800
TabIndex = 6
Top = 1200
Width = 615
End
Begin VB.CommandButton txtShow
Caption = "读取"
Height = 375
Left = 960
TabIndex = 5
Top = 1200
Width = 615
End
Begin VB.CommandButton cndSet
Caption = "设置"
Height = 375
Left = 120
TabIndex = 4
Top = 1200
Width = 615
End
Begin VB.TextBox txtCompany
Height = 285
Left = 720
TabIndex = 3
Top = 720
Width = 3375
End
Begin VB.TextBox txtName
Height = 285
Left = 720
TabIndex = 2
Top = 240
Width = 3375
End
Begin VB.Label Label2
Caption = "公司:"
Height = 495
Left = 120
TabIndex = 1
Top = 840
Width = 735
End
Begin VB.Label Label1
Caption = "姓名:"
Height = 375
Left = 120
TabIndex = 0
Top = 360
Width = 735
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cndSet_Click()
If txtName.Text = "" Then
MsgBox "请输入名字"
Exit Sub
End If
If txtCompany.Text = "" Then
MsgBox "请输入公司名称"
Exit Sub
End If
If SetKeyValue(KeyRoot.HKEY_CURRENT_USER, "Info", "username", txtName.Text, REG_SZ) And SetKeyValue(KeyRoot.HKEY_CURRENT_USER, "Info", "companyname", txtCompany.Text, REG_SZ) Then
Else
MsgBox "设置失败"
Exit Sub
End If
MsgBox "设置成功!"
txtName.Text = ""
txtCompany.Text = ""
End Sub
Private Sub cmdRestore_Click()
CDialog2.ShowOpen
If CDialog2.FileName = "" Then Exit Sub
If RestoreKey(KeyRoot.HKEY_CURRENT_USER, "Info", CDialog2.FileName) Then
MsgBox "导入成功"
txtName.Text = GetKeyValue(KeyRoot.HKEY_CURRENT_USER, "Info", "username", REG_SZ)
txtCompany.Text = GetKeyValue(KeyRoot.HKEY_CURRENT_USER, "Info", "companyname", REG_SZ)
Else
MsgBox "导入失败"
Exit Sub
End If
End Sub
Private Sub cmdSave_Click()
CDialog1.ShowSave
If CDialog1.FileName = "" Then Exit Sub
If SaveKey(KeyRoot.HKEY_CURRENT_USER, "Info", CDialog1.FileName) Then
MsgBox "导出成功"
Else
MsgBox "导出出错"
Exit Sub
End If
End Sub
Private Sub txtDelete_Click()
If DeleteKey(KeyRoot.HKEY_CURRENT_USER, "Info", "username") And DeleteKey(KeyRoot.HKEY_CURRENT_USER, "Info", "companyname") Then
MsgBox "删除成功"
Else
MsgBox "删除失败"
Exit Sub
End If
txtName.Text = ""
txtCompany.Text = ""
End Sub
Private Sub txtShow_Click()
Dim name As String
Dim company As String
txtName.Text = GetKeyValue(KeyRoot.HKEY_CURRENT_USER, "Info", "username", REG_SZ)
txtCompany.Text = GetKeyValue(KeyRoot.HKEY_CURRENT_USER, "Info", "companyname", REG_SZ)
MsgBox "读取成功"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -