![]() |
![]() |
|
|
||
| kpIni | |||||||||||||||||||||
Description
|
Dim i As Long Dim arr As Variant Dim Dest As String ' Look at all the files we need to copy. arr = ini.SectionRead(False, "Files") If IsArray(arr) = False Then Exit Function ' Loop through each entry in this section For i = LBound(arr) To UBound(arr) Dest = ini.EntryRead(arr(i)) ' Code to this copy file... Next i
INI file comments are denoted by semi-colons, and automatically stripped from each entry if desired. It would be fairly trivial to add another method to the class which would accept alternate comment characters, if for some reason the semi-colon wasn't appropriate.
This sample, or the one from which it originally derived, was published (or at least peripherally mentioned) in the following article(s):
- Got One Right!, Classic VB Corner, VSM Online, December 2008
- Lemme Tell Ya Where To Stick It, Classic VB Corner, VSM Online, January 2009
This sample uses the following API calls:
Module Library Function CIniFile.cls kernel32 GetPrivateProfileSection
GetPrivateProfileSectionNames
GetPrivateProfileString
WritePrivateProfileStringINIEDIT.FRM user SendMessage INIFILE.BAS kernel
userGetPrivateProfileInt
GetPrivateProfileString
GetProfileInt
GetProfileString
GetWindowsDirectory
WritePrivateProfileString
WriteProfileString
SendMessageDon't see what you're looking for? Here's a complete API cross-reference.
![]()
Please, enjoy and learn from this sample. Include its code within your own projects, if you wish. But, in order to insure only the most recent code is available to all, I ask that you don't share the sample by any form of mass distribution. Download kpIni.zip, 17Kb, Last Updated: Thursday, May 12, 2005
The following resources may also be of interest:
- SysFolders - Locate all the special system folders with a simple drop-in ready class module.