accessing ini files
-
dear all, how do i access ini files using vb6? Also is there any function (api or vb) through which i can know the file system on my disk rishabhs
-
dear all, how do i access ini files using vb6? Also is there any function (api or vb) through which i can know the file system on my disk rishabhs
uhh...the same way you access text files, with FileSystemObject
Dim fso as FileSystemObject
Dim txtStr as TextStreamSet txtStr = fso.OpenTextFile(file path)
Do While Not(txtStr.AtEndOfStream)
txtStr.ReadLine
Looprishabhs wrote: Also is there any function (api or vb) through which i can know the file system on my disk What did you mean by File System ? FAT32 and NTFS ?? Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning Mark Twain
Get your facts first, and then you can distort them as much as you please Mark Twain -
dear all, how do i access ini files using vb6? Also is there any function (api or vb) through which i can know the file system on my disk rishabhs
I personnally use the windows API. I declare this :
Public 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 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
to ba able to use the API function, then, in my code, when I want to read a parameter in the .INI file, I do this :
Dim l_sStringRead as String Dim l_lRet as Long l_sStringRead= " " ' I do this to allow some memory for the string which will be passed ' as a parameter l_lRet = GetPrivateProfileString("Section", "Parameter", "DefaultResult",_ l_sStringRead , Len(l_sStringRead ), "MyINIfile.INI") l_sStringRead = Left(l_sStringRead , l_lRet) ' l_lRet = length of string returned
If you want to write into the INI file, use this :Dim l_lRet as Long l_lRet = WritePrivateProfileString("Section", "Parameter", _ "ValueToStore", "MyINIfile.INI")
Hope this helps ! Jerome -
uhh...the same way you access text files, with FileSystemObject
Dim fso as FileSystemObject
Dim txtStr as TextStreamSet txtStr = fso.OpenTextFile(file path)
Do While Not(txtStr.AtEndOfStream)
txtStr.ReadLine
Looprishabhs wrote: Also is there any function (api or vb) through which i can know the file system on my disk What did you mean by File System ? FAT32 and NTFS ?? Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning Mark Twain
Get your facts first, and then you can distort them as much as you please Mark Twainthanx for ue concern "Notorious SMC" yes by file system I mean FAT32 or NTFS. how can i find out the filesystem on my harddisk along with the volume labels and partition size? rishabhs