ncowboy

导航

公告

随笔分类

收藏夹

随笔档案

文章档案

相册

最新评论

统计

常用链接

c#

Linux

阅读排行榜

评论排行榜

用vb6读写INI文件的模块

Attribute VB_Name = "Module1"
Option Explicit

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
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


Public Function ReadINI(ByVal Section As String, ByVal Key As String) As String
    Dim x As Long, Buff As String * 128, i As Integer
    x = GetPrivateProfileString(Section, Key, "", Buff, 128, App.Path + "TMPlayer.ini")
    i = InStr(Buff, Chr(0))
    ReadINI = Trim(Left(Buff, i - 1))
End Function
Public Function WriteINI(ByVal Section As String, ByVal Key As String) As String
    Dim x As Long, Buff As String * 128, i As Integer
    x = WritePrivateProfileString(Section, Key, "", Buff, 128, App.Path + "TMPlayer.ini")
    i = InStr(Buff, Chr(0))
    WriteINI = Trim(Left(Buff, i - 1))
End Function

posted on 2004-10-12 14:13 35号房客 阅读(931) 评论(1) 编辑 收藏