读写INI文件的自定义函数(VB)
来源:互联网 发布:java和php的本质区别 编辑:程序博客网 时间:2024/05/09 21:47
Private 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
Private 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
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
'写INI文件(字符串)
Public Sub WriteINI(ByVal FileName As String, ByVal App As String, ByVal Key As String, ByVal strValue As String)
Dim Result As Long
Result = WritePrivateProfileString(App, Key, strValue, FileName)
End Sub
'读整型
Public Function GetINIint(ByVal FileName As String, ByVal App As String, ByVal Key As String) As Long
Dim Result As Long
Result = GetPrivateProfileInt(App, Key, 0, FileName)
GetINIint = Result
End Function
'读字符串
Public Function GetINIstr(ByVal FileName As String, ByVal App As String, ByVal Key As String) As String
Dim Result As Long
Dim BufferStr As String * 255
Result = GetPrivateProfileString(App, Key, "", BufferStr, Len(BufferStr), FileName)
If Result = 0 Then
GetINIstr = ""
Else
GetINIstr = Left(BufferStr, Result)
End If
End Function
Private 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
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Private Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
'写INI文件(字符串)
Public Sub WriteINI(ByVal FileName As String, ByVal App As String, ByVal Key As String, ByVal strValue As String)
Dim Result As Long
Result = WritePrivateProfileString(App, Key, strValue, FileName)
End Sub
'读整型
Public Function GetINIint(ByVal FileName As String, ByVal App As String, ByVal Key As String) As Long
Dim Result As Long
Result = GetPrivateProfileInt(App, Key, 0, FileName)
GetINIint = Result
End Function
'读字符串
Public Function GetINIstr(ByVal FileName As String, ByVal App As String, ByVal Key As String) As String
Dim Result As Long
Dim BufferStr As String * 255
Result = GetPrivateProfileString(App, Key, "", BufferStr, Len(BufferStr), FileName)
If Result = 0 Then
GetINIstr = ""
Else
GetINIstr = Left(BufferStr, Result)
End If
End Function
- 读写INI文件的自定义函数(VB)
- VB读写ini文件
- VB读写INI文件
- VB读写INI文件
- VB 读写ini文件
- vb 读写.ini文件
- vb读写ini文件
- VB读写Ini文件的模块
- 读写INI文件的函数
- vb如何读写ini文件
- VB.NET读写INI文件
- [VB.NET]读写INI文件
- [VB.NET]读写INI文件
- VB.NET 读写ini文件
- vb.net 读写ini文件
- VB读写INI文件的四个函数以及相关API详细说明
- VB读取ini文件的函数
- VC中用函数读写ini文件的方法(转)
- 三层架构之数据库访问层(VB)
- 全方位深入解析恶意软件
- Learning boost 3 -- string algorithm 1
- 快速配置weblogic8.X的应用目录
- 女程序员
- 读写INI文件的自定义函数(VB)
- HTC入门
- 调用APACHE的DPCP连接池
- 多媒体阅读软件ReadM(文字篇)-详解
- 网络游戏给青少年带来了什么 (转)
- 第一次发表blog,linux起跑线
- 三层架构之数据库访问层完全篇(C#)
- 类似于ie地址栏的下拉列表:回车提交,动态提示(摘录)
- 强大的文件管理软件seleQ详解