Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Visual Basic (Classic) FAQ

Code Links

Better Function to write to an ini file by MrMoocow
Posted: 4 Aug 01

Here is a better function I whipped up to read from ini files, it still uses the default api call, but it does it in one line of code 4 u.

Instead of you having to write 3 lines of code each time for each line now you use one.

'This may maynot work I am working on it
Declare Function GetPrivateProfileString Lib "kernel32.dll" 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 ' Write INI file

Public Function Readini(Header As String, Value As String, Default As String, ini As String) As String

Read = Space(255) ' buffer\final variable
Read2 = GetPrivateProfileString(Header, Value, Default, Read, 255, ini)
Read = Left(Read, Read2)
Readini = Read

End Function

Back to Visual Basic (Classic) FAQ Index
Back to Visual Basic (Classic) Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close