📄 rwini32.frm
字号:
VERSION 5.00
Begin VB.Form frmINI
Appearance = 0 'Flat
BackColor = &H00C0C0C0&
Caption = "http://go.163.com/~tianyige"
ClientHeight = 3195
ClientLeft = 1125
ClientTop = 1770
ClientWidth = 6510
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000008&
Icon = "RWINI32.frx":0000
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 3195
ScaleWidth = 6510
Begin VB.CommandButton Command8
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "退出"
Height = 375
Left = 4920
TabIndex = 3
Top = 2040
Width = 1215
End
Begin VB.CommandButton Command6
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "清除所有"
Height = 375
Left = 4920
TabIndex = 2
Top = 1485
Width = 1215
End
Begin VB.CommandButton Command3
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "写所有"
Height = 375
Left = 4920
TabIndex = 1
Top = 915
Width = 1215
End
Begin VB.CommandButton Command7
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "读所有"
Height = 375
Left = 4920
TabIndex = 0
Top = 360
Width = 1215
End
Begin VB.Frame Frame1
Caption = "读写INI文件示例"
Height = 2655
Left = 120
TabIndex = 4
Top = 240
Width = 3375
Begin VB.TextBox Text1
Appearance = 0 'Flat
Height = 285
Left = 1320
TabIndex = 10
Top = 960
Width = 1575
End
Begin VB.CommandButton Command1
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "读序列号"
Height = 375
Left = 1800
TabIndex = 9
Top = 2040
Width = 1095
End
Begin VB.TextBox Text2
Appearance = 0 'Flat
Height = 285
Left = 1320
TabIndex = 8
Top = 480
Width = 1575
End
Begin VB.CommandButton Command2
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "读姓名"
Height = 375
Left = 360
TabIndex = 7
Top = 2040
Width = 1095
End
Begin VB.CommandButton Command4
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "写序列号"
Height = 375
Left = 1800
TabIndex = 6
Top = 1560
Width = 1095
End
Begin VB.CommandButton Command5
Appearance = 0 'Flat
BackColor = &H80000005&
Caption = "写姓名"
Height = 375
Left = 360
TabIndex = 5
Top = 1560
Width = 1095
End
Begin VB.Label Label1
Alignment = 1 'Right Justify
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "序列号:"
ForeColor = &H80000008&
Height = 195
Left = 360
TabIndex = 12
Top = 960
Width = 690
End
Begin VB.Label Label2
Alignment = 1 'Right Justify
Appearance = 0 'Flat
AutoSize = -1 'True
BackColor = &H00C0C0C0&
Caption = "姓名:"
ForeColor = &H80000008&
Height = 195
Left = 360
TabIndex = 11
Top = 480
Width = 495
End
End
Begin VB.Label lblMyMail
AutoSize = -1 'True
Caption = "sst95@21cn.com"
ForeColor = &H00FF0000&
Height = 195
Left = 4440
TabIndex = 14
Top = 2880
Width = 1470
End
Begin VB.Label lblMyWeb
Caption = "http://go.163.com/~tianyige"
ForeColor = &H00FF0000&
Height = 255
Left = 3600
TabIndex = 13
Top = 2520
Width = 2895
End
End
Attribute VB_Name = "frmINI"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Function GetPrivateProfileString Lib "Kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, lpKeyName As Any, ByVal lpDefault As String, ByVal lpRetunedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "Kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lplFileName As String) As Long
Private r As Long
Private entry As String
Private iniPath As String
Function GetFromINI(AppName As String, KeyName As String, FileName As String) As String
Dim RetStr As String
RetStr = String(255, Chr(0))
GetFromINI = Left(RetStr, GetPrivateProfileString(AppName, ByVal KeyName, "", RetStr, Len(RetStr), FileName))
End Function
Private Sub Command1_Click()
Text1.Text = GetFromINI("注册信息", "序列号", iniPath)
End Sub
Private Sub Command8_Click()
End
End Sub
Private Sub Command2_Click()
Text2.Text = GetFromINI("用户信息", "姓名", iniPath)
End Sub
Private Sub Command4_Click()
entry$ = Text1.Text
r = WritePrivateProfileString("注册信息", "序列号", entry, iniPath)
If r <> 1 Then MsgBox "写序列号出错!"
End Sub
Private Sub Command5_Click()
entry = Text2.Text
r = WritePrivateProfileString("用户信息", "姓名", entry, iniPath)
If r <> 1 Then MsgBox "写姓名出错!"
End Sub
Private Sub Command7_Click()
Text1.Text = GetFromINI("注册信息", "序列号", iniPath)
Text2.Text = GetFromINI("用户信息", "姓名", iniPath)
End Sub
Private Sub Command3_Click()
Command4_Click
Command5_Click
End Sub
Private Sub Command6_Click()
Text1.Text = ""
Text2.Text = ""
End Sub
Private Sub Form_Load()
'************************************************************
'*
'* 名称 : RWINI32
'* 日期 : 26/3/2000
'* 作者 : 天一工作室
'* 主页 : http://tyvb.126.com
'* Email: sst95@21cn.com
'* 主要功能: 读写INI文件
'*
'************************************************************
iniPath$ = App.Path + "\rwini32.ini"
Command7_Click
End Sub
Private Sub lblMyMail_Click()
ShellExecute hwnd, "open", "mailto:sst95@21cn.com", vbNullString, vbNullString, 0
End Sub
Private Sub lblMyWeb_Click()
ShellExecute 0, "open", "http://tyvb.126.com", vbNullString, vbNullString, 3
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -