module1.bas

来自「一个用VB开发的非常不错的企业ERP管理源码,值得一看.」· BAS 代码 · 共 45 行

BAS
45
字号
Attribute VB_Name = "General"
'INI用
Option Explicit
Declare Function WritePrivateProfileString& _
Lib "KERNEL32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal _
lpKeyName As Any, ByVal lpString As String, _
ByVal lpFileName As String)

Declare Function GetPrivateProfileInt Lib _
"KERNEL32" Alias "GetPrivateProfileIntA" (ByVal _
lpApplicationName As String, ByVal lpKeyName As _
String, ByVal nDefault As Long, ByVal lpFileName _
As String) As Long
Declare Function GetPrivateProfileString Lib _
"KERNEL32" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal _
lpKeyName As Any, ByVal lpDefault As String, _
ByVal lpReturnedString As String, ByVal nSize _
As Long, ByVal lpFileName As String) As Long
Public a1 As Boolean



Function GetPrivateStringValue(section$, Key$, _
File$) As String

Dim KeyValue$
Dim characters As Long
    
KeyValue$ = String$(128, 0)
    
characters = GetPrivateProfileString(section$, _
Key$, "", KeyValue$, 127, File$)

If characters > 1 Then
   KeyValue$ = Left$(KeyValue$, characters)
End If
    
GetPrivateStringValue = KeyValue$

End Function


⌨️ 快捷键说明

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