⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmini.frm

📁 用WindowsAPI访问INI文件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmini 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Sample INI program"
   ClientHeight    =   2625
   ClientLeft      =   3225
   ClientTop       =   4530
   ClientWidth     =   4890
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   2625
   ScaleWidth      =   4890
   StartUpPosition =   2  'CenterScreen
   Begin VB.TextBox Keyname 
      Height          =   285
      Left            =   120
      TabIndex        =   4
      Top             =   720
      Width           =   2295
   End
   Begin VB.TextBox appname 
      Height          =   285
      Left            =   120
      TabIndex        =   3
      Top             =   360
      Width           =   4695
   End
   Begin VB.TextBox txtvalue 
      Height          =   285
      Left            =   2520
      TabIndex        =   2
      Top             =   720
      Width           =   2295
   End
   Begin VB.CommandButton cmdget 
      Caption         =   "Recall"
      Height          =   375
      Left            =   120
      TabIndex        =   1
      Top             =   2160
      Width           =   4695
   End
   Begin VB.CommandButton cmdstore 
      Caption         =   "Store"
      Height          =   375
      Left            =   120
      TabIndex        =   0
      Top             =   1680
      Width           =   4695
   End
   Begin VB.Label Label3 
      Caption         =   "Value"
      Height          =   255
      Left            =   3480
      TabIndex        =   7
      Top             =   1080
      Width           =   495
   End
   Begin VB.Label Label2 
      Caption         =   "Setting"
      Height          =   255
      Left            =   960
      TabIndex        =   6
      Top             =   1080
      Width           =   615
   End
   Begin VB.Label Label1 
      Caption         =   "Heading"
      Height          =   255
      Left            =   1920
      TabIndex        =   5
      Top             =   0
      Width           =   735
   End
End
Attribute VB_Name = "frmini"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim IniFileName As String

Private Sub cmdget_Click()
Dim X As Long
Dim Temp As String * 50
Dim lpAppName As String, lpKeyName As String, lpDefault As String, lpFileName As String
lpAppName = appname.Text
lpKeyName = Keyname.Text
lpDefault = file
lpFileName = file
X = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, Temp, Len(Temp), lpFileName)

If X = 0 Then
    Beep
Else
    txtvalue.Text = Trim(Temp)
End If
End Sub

Private Sub cmdstore_Click()
Dim lpAppName As String, lpFileName As String, lpKeyName As String, lpString As String
Dim U As Long
lpAppName = appname.Text
lpKeyName = Keyname.Text
lpString = txtvalue.Text
lpFileName = file
U = WritePrivateProfileString(lpAppName, lpKeyName, lpString, lpFileName)
If U = 0 Then
Beep
End If
End Sub


Private Sub Form_Initialize()
    IniFileName = file
End Sub


Private Sub Form_Load()
file = InputBox("Which file do you want to read/edit/create?")
End Sub


Private Sub Label1_Click()

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -