Create INI file
Hi everybody,
I would like to know how to create INI file and how to connect to VB6.0.
If you have simple example I appreciated a lot.
Thanks for your help.
Bill
# 1 Re: Create INI file
Bill,
Create a text file and write what are all sections you need and save it as INi file with extension .INi instead of txt and save it. Now you can access the ini file using VB as shwn below throgh an API called " GetPrivateprofilestring".This would be helpful.
Dim nret As Long, nret1 As Long
'Dim strCCSSharedDirectory As String, strCCSDirectory As String
'Reading the CCSDirectory from Lablink.Ini file under section "WD"
'C:\Lia\Ccs is the default value
'Reading Lia Directory
strIniFileName = "C:\Lia\Lablink.ini" ' is the source
strCCSDir = Space(255)
nret = GetPrivateProfileString("WD", "CCSDirectory", "c:\Lia\CCS", _
strCCSDir, 254, strIniFileName)
strCCSDir = Left(strCCSDir, nret)
'Reading the CCSSharedDirectory from lablink.Ini file
strCCSSharedDirectory = Space(255)
nret1 = GetPrivateProfileString("WD", "CCSSharedDirectory", "c:\Lia\CCS", _
strCCSSharedDirectory, 254, strIniFileName)
strCCSSharedDirectory = Left(strCCSSharedDirectory, nret)
'Declare strLof file to create log file to show the activities of the CCS
strLogFile = strCCSSharedDirectory & "\CCSLogFile.txt"
'Reading the AtlasTransLabinDirectory from lablink.Ini file
strAtlasTransLabinDirectory = Space(255)
nret1 = GetPrivateProfileString("WD", "AtlasTransLabinDirectory", "c:\Lia\CCS", _
strAtlasTransLabinDirectory, 254, strIniFileName)
strAtlasTransLabinDirectory = Left(strAtlasTransLabinDirectory, nret1)