Page 1 of 3 123 LastLast
Results 1 to 15 of 39
  1. #1
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PrivateProfileString Limit?

    Does the privateprofilestring command have a limit on the length of the string it can write?

    I've got an ini file entry that needs to be up to 700 characters long, but privateprofilestring writes only 253 chars.

    If this is the limit, is there an alternative?
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  2. #2
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    Kevin,

    Congratulations on your new ribbon.

    Alternatives might be:
    .Split the string into 3
    .Write your own ini file read/write. Nit all that hard to do- though I haven't done that for a while. Chris might have aomething- check the archive
    .Look at API calls
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  3. #3
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    Geoff,

    Thanks for the 'grats.

    I'll investigate these. Chris, same me some hog nosing and post me what I need!
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  4. #4
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    Maybe a start in <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showflat.pl?Cat=&Board=vb&Number=28030&page=&view= &sb=&o=&vc=1>this thread</A>?
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  5. #5
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    >same me some hog nosing

    So it's the same old Kevin-the-hog, eh? Oh well ....

    You want the good news or the bad news?


    Good: I decided to pull the INI routines out of my utils.dot and post them on the web in full source regalia.
    Bad: I haven't posted them yet.
    Good: I cleaned them up, streamlined them
    Bad: The 255/256 limit got me to thinking of a neat way to circumvent that while still making use of the apiPutPrivateProfileString and apiGetPrivateProfileString functions.
    Good:The new code has luvverley test examples, better than the usual stuff I post.
    Bad: Today I drive out the east end to install a new computer for a sweet little old lady .....
    Good: I loves ya almost as much as I love the LOL, so I'll get onto it as soon as I return home, truffles.

  6. #6
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    Yabbut "this thread" is horribly convoluted. I think it's a classic case of the argument for sumamrizing a thread to see if there's any part that has redeeming social value. I just went had a look, and I'm either ashamed or terrified. Either way I'm not coming out from under the bed for a while ...

  7. #7
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    <hr>Either way I'm not coming out from under the bed for a while ...<hr>
    Is that a promise? <img src=/S/grin.gif border=0 alt=grin width=15 height=15>
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  8. #8
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    Gee Wiz, GW, look at that thread!

    I guess when you offer a premium or prize for solving problems you get lots of attention. That Stever G. has got us pegged.

    I look forward to reading the whole thing. And it looks like the topic might have some code I'm been looking for for my "imitate recents" list. Thank you!
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  9. #9
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    Chris,

    You are either a briliant guy or an average guy with a bunch of loose screws. I can't decide.

    What is "luvverley"? An adjective? A lunar landing module? Canadian for "home plate"?

    I hope the little old lady appreciates how much trouble she's causing me while you abandon your comrades in need.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  10. #10
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    > You are either a briliant guy or an average guy with a bunch of loose screws.

    Let's see, it's Wednesday, so the answer is ...

    Luvverly, as in My Fair Lady, well before your time, my son (vbg)


    OK. I have built a page <A target="_blank" HREF=http://www.vif.com/users/cgreaves/INI.htm>here</A> with my current code. This version allows you to switch environments via the INI file itself, heh heh.

    On the way home I worked out how to get around the 255 limit imposed by APIProfile string without the user (that's us VBA coders) needing to know about. I'm a transparent sort of guy.


    HOWEVER I don't get to be brilliant until well after Sundown on Wednesdays, so the code won't be available until tomorrow. I'll post here when it's up.


    You guys looking at mars these nights?

  11. #11
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    Kevin,

    Might you consider using the Scripting Runtime library, which has a nice text file handling objext called Textstream in addition to File handling functions.

    The following sample code writes a string of 1000 characters + <pre>Sub WriteToINI()
    Dim fso As Scripting.FileSystemObject
    Dim txtOut As Scripting.TextStream
    Set fso = New FileSystemObject
    Set txtOut = fso.CreateTextFile("D:TextStreamINI.txt")
    For i = 1 To 100
    TestStr = TestStr & "0123456789"
    Next i
    With txtOut
    .Write "[Heading]" & vbCr
    .WriteLine "Test1= " & TestStr
    .WriteBlankLines 1
    .WriteLine "Test2= " & StrReverse(TestStr)
    End With
    Set tsOut = Nothing
    End Sub </pre>


    It is only a sample, and shows what be done if you can utilise the above library.

    Andrew C

  12. #12
    Gold Lounger
    Join Date
    Dec 2000
    Location
    Hollywood (sorta), California, USA
    Posts
    2,759
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    Andrew,

    That's an excellent idea. Where do you get your info on the Scripting library? I never consider FSOs because I have no help file or tutorial on the object model.

    I've got to learn more about it. Thanks much.
    Kevin <IMG SRC=http://www.wopr.com/w3tuserpics/Kevin_sig.gif alt="Keep the change, ya filthy animal...">
    <img src=/w3timages/blackline.gif width=33% height=2><img src=/w3timages/redline.gif width=33% height=2><img src=/w3timages/blackline.gif width=33% height=2>

  13. #13
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: PrivateProfileString Limit?

    Hi Kevin,

    If you've still got Office 97, then you either do or don't have MS Scripting Runtime - depends on what other components may have gotten installed. A look at Tools>References will reveal.

    An eye-opening intro to working with text files using FSO, can be found in a recent article by Peter Aiken in MS Office Pro magazine. The article can be accessed online <A target="_blank" HREF=http://www.msofficepro.com/features/2001/06/vba200106pa_f/vba200106pa_f.asp>here</A> - but you do need a subscription to the magazine (or a trial subscription) to access the article. (I don't know what it says about me, that spying a new issue of this mag in my mailbox elicits the same kind of enthusiasm I used to feel when a new issue of Surfer arrived!)

    Gary

  14. #14
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    Even if you don't have a reference set, you may have and "scrrun.dll".
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

  15. #15
    Platinum Lounger
    Join Date
    Dec 2000
    Location
    Queanbeyan, New South Wales, Australia
    Posts
    3,730
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: PrivateProfileString Limit?

    Andrew,

    While I have used FileScriptingObject for things involving directory checking, date/time stamp processing etc, I can't see from your example why it is needed.

    Would the following achieve the same?
    <pre>Sub WriteToINI()
    Dim i As Integer
    Dim TestStr As String
    Dim iFileno As Integer

    iFileno = FreeFile
    For i = 1 To 100
    TestStr = TestStr & "0123456789"
    Next i
    Open "D:TextStreamINI.txt" For Output As #1
    Print #1, "[Heading]" & vbCrLf & _
    "Test1= " & TestStr & vbCrLf & _
    "Test2= " & StrReverse(TestStr)
    Close #1
    End Sub</pre>


    Of course, you may well be leading further...

    Also, I suspect you have not used "Option Explicit"- I suspect the "Set tsOut = Nothing" should be "set txtOut = Nothing".
    Subway Belconnen- home of the Signboard to make you smile. Get (almost) daily updates- follow SubwayBelconnen on Twitter.

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •