谁帮我写一个ini

发布网友 发布时间:2022-04-21 19:44

我来回答

2个回答

热心网友 时间:2023-06-24 22:54

我写的xywhAPI有此功能并且同时加载很多不同状况的INI和保存INI

下载:
里面有相当详细的使用函数说明

不使用xywhAPI可以取xywhAPI的片段实现功能:

声明:
'-----------------------ini文件读写函数API声明
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 Integer, ByVal lpFileName As String) As Integer
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileSection Lib "kernel32" Alias "GetPrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileSection Lib "kernel32" Alias "WritePrivateProfileSectionA" (ByVal lpAppName As String, ByVal lpString As String, ByVal lpFileName As String) As Long
Private iniPaths As String
Private iniPros As String

代码:
'-----------------------ini文件路径属性
Public Property Get iniPath() As String
iniPath = iniPaths
End Property
'-----------------------ini文件路径属性
Public Property Let iniPath(ByVal vNewValue As String)
iniPaths = vNewValue
End Property
'-----------------------读取ini文件的函数过程(长字符操作)
Public Function loadinisl(inint As String) As String
Dim strini As String * 32767
Call GetPrivateProfileString(iniPros, inint, "Default Caption", strini, 32767, iniPaths)
loadinis = VBA.Trim(strini)
End Function
'-----------------------读取ini文件的函数过程(短字符操作)
Public Function loadinisa(inint As String) As String
Dim strini As String * 255
Call GetPrivateProfileString(iniPros, inint, "Default Caption", strini, 255, iniPaths)
loadinis = VBA.Trim(strini)
End Function
'-----------------------读取ini文件的函数过程(数字参数操作)
Public Function loadinia(inint As String) As Long
loadinia = GetPrivateProfileInt(iniPros, inint, loadinia, iniPaths)
End Function
'-----------------------读取ini文件的函数过程(布尔参数操作)
Public Function loadinib(inint As String) As Boolean
If GetPrivateProfileInt(iniPros, inint, loadinib, iniPaths) = 0 Then loadinib = True
If GetPrivateProfileInt(iniPros, inint, loadinib, iniPaths) <> 0 Then loadinib = False
If loadinisa(inint) = "true" Or "True" Then loadinib = True
If loadinisa(inint) = "false" Or "False" Then loadinib = False
End Function
'-----------------------ini文件节点属性
Public Property Get inipro() As String
inipro = iniPros
End Property
'-----------------------ini文件节点属性
Public Property Let inipro(ByVal vNewValue As String)
iniPros = vNewValue
End Property
'-----------------------写入INI信息函数
Public Sub saveini(inint As String, stri As String)
Call WritePrivateProfileString(iniPros, inint, stri, iniPaths)
End Sub

这些内容放在一个类中

dim xa as new class1

xa.inipath = "这里设置INI的路径"
xa.inipro = "这里设置操作节点"

其余按照相应的函数来操作即可

热心网友 时间:2023-06-24 22:54

这个跟你的ubuntu安装方法有关系。

如果你是xp下用wubi安装的ubuntu,boot.ini写法如下
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
c:\wubildr.mbr="Ubuntu"

如果是用的grub引导ubuntu,boot.ini写法如下
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /noexecute=optin /fastdetect
c:\grldr="Ubuntu"
(说明:c盘下需要有grldr和menu.lst)

声明声明:本网页内容为用户发布,旨在传播知识,不代表本网认同其观点,若有侵权等问题请及时与本网联系,我们将在第一时间删除处理。E-MAIL:11247931@qq.com