Tom,
No problem at all.
Configuration files (and wmbb's text files by the look of it), are split into sections (denoted with brackets []). Within these sections are keys, which also have a correspondong value associated with them. To use what we have as an example:
Code:
[b]Section - [/b][Vector]
[b]Key - [/b]Magnification
[b]Value - [/b]300.000
The function basically takes the section and key parameters (and the location of the file) and returns a value (type long) with the length of the found value (the return will be 0 if the Section, Key, Value or File aren't found)
So, they're the parameters that tell the function what you're looking for and where it is. The three remaining parameters are your Default Value (in this case "" but for some reason I've got it in as "" & "" but it will still work), your Return Buffer (a fixed length string declared, in this case, as Dim strReturn As String * 255) and the length of the return buffer (254 I've got in this case)
The parameters are passed to the function ByVal (meaning that if the function modifies them then the modified variables will remain modified outside of the scope of the function as well as within it. I'm aware that I'm skimming over the ByVal/ByRef explaination but that's another topic if anyone reading this doesn't understand the difference), and while within the function the Return Buffer is modified to contain the found Value (however it is still 255 in length, more on this later).
We use the Return of the function to determine how many characters where in the found value and link that in with the Return Buffer to return the value (as demonstrated by
strMag = Left$(strReturn, lngLen))
Hope that's helped give you a better understanding of the function (sorry if I got too basic
![[blush] [blush] [blush]](/data/assets/smilies/blush.gif)
).
The only reason I could think that you'd get no return is that one of Section, Key or File paramters can't be found (and for me it's usually because I've spelled something incorrectly). I say this because I copied the text from wmbb's OP into a text file and then copied the code I'd posted (to make sure I'd not modified it by accident while posting) into a command button and I got the expected msgbox containing the value 300.000.
Further than that, if you still can't get it to work, post back I'll see if there's anything more I can think of to help
Hope this helps
HarleyQuinn
---------------------------------
Get the most out of Tek-Tips, read FAQ222-2244 before posting.