Automating QTP Test Automation Home Automation Articles Downloads QTP Gotchas Links Books Contact About Site Map
General Function - Get IniThis function gets a value from an .ini file Ini files are great, you can easily edit them without any fear of corrupting anything (unlike the Registry). See also the companion function Set Ini Download it Here (right-click and then save target as). (NOTE - you can just cut & paste from below, but the formatting will have multiple spaces instead of tabs).
'=========================================================================
Function zGen_GetIni(sIniFile, sSection, sKey, sDefault) Dim iRet, sReturnString Extern.Declare micLong, "GetPrivateProfileString", "kernel32.dll", "GetPrivateProfileStringA", micString, micString, micString, micString + micByRef, micDWord, micString iRet = Extern.GetPrivateProfileString( sSection, sKey, sDefault, sReturnString, 256, sIniFile ) If iRet > 0 Then zGen_GetIni = sReturnString Else zGen_GetIni = sDefault End If End Function '========================================================================= |