Simple INI file class Los Angeles CA

INI Files now seem to have been completely removed by the registry, but sometimes they are a much better option.

Local Companies

Moyea Software
92295612365
Hot building, ring street
LA, CA
Interneer Inc.
8005586832 x85
6101 W. Centinela Ave.
Culver City, CA
Cornerstone Concepts Inc
818-247-3909
600 W Broadway
Glendale, CA
Greene Computer Corporation
(818) 956-4961
200 S. Louise Street
Glendale, CA
Corticalx Inc Software Solutions & Technology
818-500-0881
425 E Colorado St
Glendale, CA
Alphatier Systems
818-409-8920
517 Griswold St
Glendale, CA
TimeTECH - Customizable Time and Attendance / Workforce Management Solutions
905-677-7009
7420 Airport Rd 203
Mississauga, CA
Hutchinson & Bloodgood, LLP
(818) 637-5000
101 N. Brand Blvd. #1600
Glendale, CA
Telsoft Solutions
818-545-8680
100 N Brand Blvd
Glendale, CA
Abraxas Technologies Inc
818-502-9100
450 N Brand Blvd
Glendale, CA

provided by: 
Originally published at Internet.com


INI Files now seem to have been completely removed by the registry, but sometimes they are a much better option. This can be becuase of safety for the registry, and allowing the user to more easily view and change settings. This simple wrapper class wraps up a few simple INI file functions into a reusable, drop in class for instant INI file use. It supports the following methods/properties: * CreateINI - Creates a new INI file * GetFile - Returns the value specified in the arguements passed * INIFile - Gets/Sets the current INI file path * MakePath - A private function used to create the ini file * WriteFile - Writes a value to the INI file

You will probably want to extend its functionality by adding more INI file functions. Anyway, the class is based around two Win API declares: WritePrivateProfileString and GetPrivateProfileString. Both require a bit of extra work to make them effective, but overall they are quite simple to use. A good alternative to the Windows Registry.

To get the class working just use: Private m_cIni As CIniFile Private Sub Form_Load() Set m_cIni = New CIniFile End Sub

Add a new class module (CIniFIle) and copy the following code into it: Option Explicit '// Private member that holds a reference to '// the path of our ini file Private strInI As String '// Win API Declares Private 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 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 Private Function MakePath(ByVal strDrv As String, _ ByVal strDir As String) As String '// Makes an INI file: Guarantees a sub dir Do While Right$(strDrv, 1) = "\" strDrv = Left$(strDrv, Len(strDrv) - 1) Loop Do While Left$(strDir, 1) = "\" strDir = Mid$(strDir, 2) Loop '// Return the path MakePath = strDrv & "\" & strDir End Function Public Sub CreateIni(strDrv As String, strDir As String) '// Make a new ini file strInI = MakePath(strDrv, strDir) End Sub Public Sub WriteFile(strSection As String, _ strKey As String, _ strValue As String) '// Write to strINI WritePrivateProfileString strSection, _ strKey, strValue, strInI End Sub Public Function GetFile(strSection As String, _ strKey As String) As String Dim strTmp As String Dim lngRet As String strTmp = String$(100, 0) lngRet = GetPrivateProfileString(strSection, _ strKey, "", strTmp, _ Len(strTmp), strInI) GetFile = strTmp End Function Public Property Let INIFile(ByVal New_IniPath As String) '// Sets the new ini path strInI = New_IniPath End Property Public Property Get INIFile() As String '// Returns the current ini path INIFile = strInI End Property

Author: Sam Huggill

Read article at Internet.com site

Featured Local Company

Moyea Software

92295612365
Hot building, ring street
LA, CA

Related Local Events
Automation Technology Expo West (ATX West)
Dates: 2/9/2010 - 2/11/2010
Location: Anaheim Convention Center
Anaheim, CA
View Details

SOLAR POWER - Exhibition and Conference
Dates: 10/12/2010 - 10/14/2010
Location: Los Angeles Convention & Exhibition Center
Los Angeles, CA
View Details

REAL-TIME & EMBEDDED COMPUTING CONFERENCE - LONG BEACH 2009
Dates: 10/1/2009 - 10/1/2009
Location: Marriott Long Beach
Long Beach, CA
View Details

2009 IEEE Petroleum and Chemical Industry Technical Conference (PCIC 2009)
Dates: 9/14/2009 - 9/16/2009
Location:
Anaheim, CA
View Details

Medical Design & Manufacturing - Trade
Dates: 6/9/2009 - 6/11/2009
Location: CANON COMMUNICATIONS LLC
Los Angeles, CA
View Details