-
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?
-
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 :)
-
yes, my mp3 player (shameless advertising :D) uses the registry to store data such as that, and the window pos and stuff like that
-
:D 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"
-
i use api reg functions cuz you don't get it all in that sh*t vb and vba section
-
True indeed. Could you post examples? :)
-
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 :D
-
*rofl* I guess I could practice what I preach and search the Forums, Eh? :) Or hit allapi.net ;)
-
ah, allapi... a resource for everything :D yeah, i was gunna suggest searching... but then people just b*tch so i just keep my mouth shut