GetPrivateProfileSection Not Working???


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: GetPrivateProfileSection Not Working???

  1. #1
    Gregory Silvano Guest

    RE: GetPrivateProfileSection Not Working???

    Hi Sheldon,

    There are plenty of examples out there.

    http://www.mvps.org/vbnet/index.html...ofilebasic.htm
    http://www.vbexplorer.com/focus/ini_tutorial_2.asp
    http://home.earthlink.net/~zombiehead/iniFile.htm
    http://www.thescarms.com/vbasic/registry.asp


    Regards,

    Gregory Silvano
    http://www.codehound.com
    ******************************************************
    Search the best Visual Basic Web sites and
    millions of developer newsgroup posts at
    CodeHound!

    Download our FREE Add-In for Visual Basic
    and search the Internet right from your VB IDE!
    ******************************************************

    -----Original Message-----


    Appleman's VB API, AllAPI.Net, etc.

    I can't find an example for this call! The following doesn't
    work?

    Module General Section:

    Private Declare Function GetPrivateProfileSection Lib "kernel32" _
    Alias "GetPrivateProfileSectionA" _
    (ByVal lpAppName As String, _
    ByVal lpReturnedString As String, _
    ByVal nSize As Long, _
    ByVal lpFileName As String) _
    As Long
    Modules:

    Function GetIniSexn(SexnName$, MaxCharsToReturn&, IniFile$) As String
    ReturnLgth& = GetPrivateProfileSection(SexnName$, ReturnData$,
    MaxCharsToReturn&, IniFile$)
    Temp$ = Left$(ReturnData$, ReturnLgth&)
    If Len(Temp$) Then
    Temp$ = Replace(Temp$, Chr(0), ";")
    End If
    GetIniSexn = Temp$
    End Function

    sub main()
    SexnName$ = "DataBase"
    MaxLen& = 256
    IniFile$ = "c:\my documents\conn.ini"
    a$ = GetIniSexn(SexnName$, MaxLen&, IniFile$)
    end sub




  2. #2
    Sheldon Rosenfeld Guest

    GetPrivateProfileSection Not Working???


    Appleman's VB API, AllAPI.Net, etc.

    I can't find an example for this call! The following doesn't
    work?

    Module General Section:

    Private Declare Function GetPrivateProfileSection Lib "kernel32" _
    Alias "GetPrivateProfileSectionA" _
    (ByVal lpAppName As String, _
    ByVal lpReturnedString As String, _
    ByVal nSize As Long, _
    ByVal lpFileName As String) _
    As Long


    Modules:

    Function GetIniSexn(SexnName$, MaxCharsToReturn&, IniFile$) As String
    ReturnLgth& = GetPrivateProfileSection(SexnName$, ReturnData$,
    MaxCharsToReturn&, IniFile$)
    Temp$ = Left$(ReturnData$, ReturnLgth&)
    If Len(Temp$) Then
    Temp$ = Replace(Temp$, Chr(0), ";")
    End If
    GetIniSexn = Temp$
    End Function

    sub main()
    SexnName$ = "DataBase"
    MaxLen& = 256
    IniFile$ = "c:\my documents\conn.ini"
    a$ = GetIniSexn(SexnName$, MaxLen&, IniFile$)
    end sub




  3. #3
    Sheldon Rosenfeld Guest

    Re: GetPrivateProfileSection Not Working???


    Just want to thank you before I run off
    to check this out...

    Sheldon

    "Gregory Silvano" <gsilvano@codehound.com> wrote in message
    news:3c962ae9@10.1.10.29...
    > Hi Sheldon,
    >
    > There are plenty of examples out there.
    >
    > http://www.mvps.org/vbnet/index.html...ofilebasic.htm
    > http://www.vbexplorer.com/focus/ini_tutorial_2.asp
    > http://home.earthlink.net/~zombiehead/iniFile.htm
    > http://www.thescarms.com/vbasic/registry.asp
    >
    >
    > Regards,
    >
    > Gregory Silvano
    > http://www.codehound.com
    > ******************************************************
    > Search the best Visual Basic Web sites and
    > millions of developer newsgroup posts at
    > CodeHound!
    >
    > Download our FREE Add-In for Visual Basic
    > and search the Internet right from your VB IDE!
    > ******************************************************
    >
    > -----Original Message-----
    >
    >
    > Appleman's VB API, AllAPI.Net, etc.
    >
    > I can't find an example for this call! The following doesn't
    > work?
    >
    > Module General Section:
    >
    > Private Declare Function GetPrivateProfileSection Lib "kernel32" _
    > Alias "GetPrivateProfileSectionA" _
    > (ByVal lpAppName As String, _
    > ByVal lpReturnedString As String, _
    > ByVal nSize As Long, _
    > ByVal lpFileName As String) _
    > As Long
    > Modules:
    >
    > Function GetIniSexn(SexnName$, MaxCharsToReturn&, IniFile$) As String
    > ReturnLgth& = GetPrivateProfileSection(SexnName$, ReturnData$,
    > MaxCharsToReturn&, IniFile$)
    > Temp$ = Left$(ReturnData$, ReturnLgth&)
    > If Len(Temp$) Then
    > Temp$ = Replace(Temp$, Chr(0), ";")
    > End If
    > GetIniSexn = Temp$
    > End Function
    >
    > sub main()
    > SexnName$ = "DataBase"
    > MaxLen& = 256
    > IniFile$ = "c:\my documents\conn.ini"
    > a$ = GetIniSexn(SexnName$, MaxLen&, IniFile$)
    > end sub
    >
    >
    >




  4. #4
    Sheldon Rosenfeld Guest

    Re: GetPrivateProfileSection Not Working???


    Thanks again.

    For anyone interested, the MVP site initialized the
    returned string's size prior to the call (this worked).

    Oddly, the GetPrivateProfileString doesn't require this!


    "Gregory Silvano" <gsilvano@codehound.com> wrote in message
    news:3c962ae9@10.1.10.29...
    > Hi Sheldon,
    >
    > There are plenty of examples out there.
    >
    > http://www.mvps.org/vbnet/index.html...ofilebasic.htm
    > http://www.vbexplorer.com/focus/ini_tutorial_2.asp
    > http://home.earthlink.net/~zombiehead/iniFile.htm
    > http://www.thescarms.com/vbasic/registry.asp
    >





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center