Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. accessing ini files

accessing ini files

Scheduled Pinned Locked Moved Visual Basic
questionjson
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    r i s h a b h s
    wrote on last edited by
    #1

    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

    N J 2 Replies Last reply
    0
    • R r i s h a b h s

      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

      N Offline
      N Offline
      Nick Seng
      wrote on last edited by
      #2

      uhh...the same way you access text files, with FileSystemObject

      Dim fso as FileSystemObject
      Dim txtStr as TextStream

      Set txtStr = fso.OpenTextFile(file path)
      Do While Not(txtStr.AtEndOfStream)
      txtStr.ReadLine
      Loop

      rishabhs 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

      R 1 Reply Last reply
      0
      • R r i s h a b h s

        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

        J Offline
        J Offline
        Jerome Conus
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • N Nick Seng

          uhh...the same way you access text files, with FileSystemObject

          Dim fso as FileSystemObject
          Dim txtStr as TextStream

          Set txtStr = fso.OpenTextFile(file path)
          Do While Not(txtStr.AtEndOfStream)
          txtStr.ReadLine
          Loop

          rishabhs 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

          R Offline
          R Offline
          r i s h a b h s
          wrote on last edited by
          #4

          thanx 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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups