Results 1 to 9 of 9

Thread: INI Files

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Posts
    80

    Unhappy INI Files

    I have a program that opens 3 dialogue boxes.
    However, I want the paths to these dialogue boxes to be saved to an INI file so that when the user loads the program the next time, the file paths are still intact.

    I have seen code to do this, but it's VERY long and I was wondering if there is an easier way?

  2. #2
    Fanatic Member ExcalibursZone's Avatar
    Join Date
    Feb 2000
    Location
    Western NY State
    Posts
    908
    You can actually use SaveSetting which uses the Registry for such simple information. Though if you need to write to an ini, a search would prove fruitful. but here's the code anyway:
    Code:
    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
    
    Private Sub Form_Load()
        WritePrivateProfileString "C:\MyINI.ini", "MyFilePath1", Path$
    End Sub
    Hope that helps you out
    -Excalibur

  3. #3
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    yes, my mp3 player (shameless advertising ) uses the registry to store data such as that, and the window pos and stuff like that
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  4. #4
    Fanatic Member ExcalibursZone's Avatar
    Join Date
    Feb 2000
    Location
    Western NY State
    Posts
    908
    The registry is handy and fast for junk like that I use the Registry for my MUD creation tool ZoneWriter to store recent files, paths, window sizing, and preferences. SaveSetting, GetSetting, and DeleteSetting, three very happy functions.
    Code:
    SaveSetting App.Title, "Paths", "FilePath1", Path$
    Path$ = GetSetting(App.Title, "Paths", "FilePath1", App.Path)
    DeleteSetting App.Title, "Paths", "FilePath1"
    -Excalibur

  5. #5
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    i use api reg functions cuz you don't get it all in that sh*t vb and vba section
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  6. #6
    Fanatic Member ExcalibursZone's Avatar
    Join Date
    Feb 2000
    Location
    Western NY State
    Posts
    908
    True indeed. Could you post examples?
    -Excalibur

  7. #7
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    um, sorry but actually i can't as i am formatting this computer so currently the only things on it are VC++ and my MP3 Player... so all my source is on a CD-RW somewhere in my room *i can hear my mom saying that ill find it if i clean my room already
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

  8. #8
    Fanatic Member ExcalibursZone's Avatar
    Join Date
    Feb 2000
    Location
    Western NY State
    Posts
    908
    *rofl* I guess I could practice what I preach and search the Forums, Eh? Or hit allapi.net
    -Excalibur

  9. #9
    Frenzied Member Skitchen8's Avatar
    Join Date
    Feb 2001
    Location
    Binghamotn, NY
    Posts
    1,943
    ah, allapi... a resource for everything yeah, i was gunna suggest searching... but then people just b*tch so i just keep my mouth shut
    Government is another way to say better…than…you.
    It’s like ice but no pick, a murder charge that won’t stick,
    it’s like a whole other world where you can smell the food,
    but you can’t touch the silverware.
    Huh, what luck. Fascism you can vote for.
    Humph, isn’t that sweet?
    And we’re all gonna die some day, because that’s the American way
    -Stone Sour

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width